org.apache.struts2.dispatcher
Class ServletRedirectResult
java.lang.Object
org.apache.struts2.dispatcher.StrutsResultSupport
org.apache.struts2.dispatcher.ServletRedirectResult
- All Implemented Interfaces:
- com.opensymphony.xwork2.Result, java.io.Serializable, StrutsStatics
- Direct Known Subclasses:
- ServletActionRedirectResult
public class ServletRedirectResult
- extends StrutsResultSupport
Calls the sendRedirect
method to the location specified. The response is told to redirect the
browser to the specified location (a new request from the client). The
consequence of doing this means that the action (action instance, action
errors, field errors, etc) that was just executed is lost and no longer
available. This is because actions are built on a single-thread model. The
only way to pass data is through the session or with web parameters
(url?name=value) which can be OGNL expressions.
This result type takes the following parameters:
- location (default) - the location to go to after execution.
- parse - true by default. If set to false, the location param will
not be parsed for Ognl expressions.
This result follows the same rules from StrutsResultSupport
.
Example:
<result name="success" type="redirect">
<param name="location">foo.jsp</param>
<param name="parse">false</param>
</result>
- See Also:
- Serialized Form
Method Summary |
protected void |
doExecute(java.lang.String finalLocation,
com.opensymphony.xwork2.ActionInvocation invocation)
Redirects to the location specified by calling HttpServletResponse.sendRedirect(String) . |
void |
setPrependServletContext(boolean prependServletContext)
Sets whether or not to prepend the servlet context path to the redirected URL. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
prependServletContext
protected boolean prependServletContext
ServletRedirectResult
public ServletRedirectResult()
ServletRedirectResult
public ServletRedirectResult(java.lang.String location)
setPrependServletContext
public void setPrependServletContext(boolean prependServletContext)
- Sets whether or not to prepend the servlet context path to the redirected URL.
- Parameters:
prependServletContext
- true to prepend the location with the servlet context path,
false otherwise.
doExecute
protected void doExecute(java.lang.String finalLocation,
com.opensymphony.xwork2.ActionInvocation invocation)
throws java.lang.Exception
- Redirects to the location specified by calling
HttpServletResponse.sendRedirect(String)
.
- Specified by:
doExecute
in class StrutsResultSupport
- Parameters:
finalLocation
- the location to redirect to.invocation
- an encapsulation of the action execution state.
- Throws:
java.lang.Exception
- if an error occurs when redirecting.
Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.