本文整理汇总了Java中org.apache.struts.action.ActionForward.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java ActionForward.getPath方法的具体用法?Java ActionForward.getPath怎么用?Java ActionForward.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.struts.action.ActionForward
的用法示例。
在下文中一共展示了ActionForward.getPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleBeanUtilsPopulateError
import org.apache.struts.action.ActionForward; //导入方法依赖的package包/类
/**
* Handle bean population errors that are not crucial to flow of control. For example, if we have a
* beanUtils.populate exception when the user is trying to navigate somewhere outside of the editor, then
* let the navication happen without throwing an exception. Otherwise test for timeout and present message,
* else, assume its a "back button" problem and show message.
*
* @param request NOT YET DOCUMENTED
* @param response NOT YET DOCUMENTED
* @exception ServletException NOT YET DOCUMENTED
* @exception IOException NOT YET DOCUMENTED
*/
private void handleBeanUtilsPopulateError(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
prtln("handling BeanUtils Populate Error");
SessionRegistry sessionRegistry =
(SessionRegistry) servlet.getServletContext().getAttribute("sessionRegistry");
SessionBean sessionBean = (sessionRegistry != null) ? sessionRegistry.getSessionBean(request) : null;
String requestUrl = getRequestUrl(request);
String contextPath = request.getContextPath();
// default destination
String destination = response.encodeURL(contextPath + "/populate_error.jsp");
// has the session timed out?
if (sessionBean != null && sessionBean.getNumSecsToTimeout() < 1) {
destination = response.encodeURL(contextPath + "/session_timed_out.jsp");
}
else {
// prtln("NOT TIMED OUT!");
/*
prtln("request parameters");
for (Enumeration i = request.getParameterNames(); i.hasMoreElements(); ) {
prtln("\t" + (String) i.nextElement());
}
*/
String command = request.getParameter("command");
if (command != null && command.equals("exit")) {
String pathArg = request.getParameter("pathArg");
prtln("processing a \"guardedExit\" command");
prtln("\t command: " + command);
prtln("\t pathArg: " + pathArg);
prtln ("\t contextPath: " + contextPath);
if (pathArg != null && pathArg.equals("forwardToCaller")) {
ActionForward forward = SchemEditUtils.forwardToCaller(request, request.getParameter("recId"), sessionBean);
destination = contextPath + forward.getPath();
}
else {
if (pathArg.startsWith("http://"))
destination = response.encodeURL(pathArg);
else
destination = response.encodeURL(contextPath + pathArg);
}
}
}
prtln("destination: " + destination);
response.sendRedirect(destination);
}
示例2: strutsForwardToURL
import org.apache.struts.action.ActionForward; //导入方法依赖的package包/类
/**
* Takes a Struts forward containing the path such as /DisplayRequest.do and turns it into a full URL including
* servername
*/
protected String strutsForwardToURL(ActionForward forward) {
return Configuration.get(ConfigurationKeys.SERVER_URL) + ActivityMapping.LEARNING + forward.getPath();
}