Save This Page
Home » struts-2.1.8.1-src » org.apache » struts2 » dispatcher » [javadoc | source]
org.apache.struts2.dispatcher
public class: ServletRedirectResult [javadoc | source]
java.lang.Object
   org.apache.struts2.dispatcher.StrutsResultSupport
      org.apache.struts2.dispatcher.ServletRedirectResult

All Implemented Interfaces:
    com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler, com.opensymphony.xwork2.Result, StrutsStatics

Direct Known Subclasses:
    ServletActionRedirectResult

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:

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>
Field Summary
protected  boolean prependServletContext     
protected  ActionMapper actionMapper     
protected  int statusCode     
protected  boolean supressEmptyParameters     
protected  Map<String, String> requestParameters     
Fields inherited from org.apache.struts2.dispatcher.StrutsResultSupport:
DEFAULT_PARAM
Constructor:
 public ServletRedirectResult() 
 public ServletRedirectResult(String location) 
Method from org.apache.struts2.dispatcher.ServletRedirectResult Summary:
addParameter,   doExecute,   getProhibitedResultParams,   handle,   sendRedirect,   setActionMapper,   setPrependServletContext,   setStatusCode,   setSupressEmptyParameters
Methods from org.apache.struts2.dispatcher.StrutsResultSupport:
conditionalParse,   doExecute,   execute,   getLastFinalLocation,   getLocation,   setEncode,   setLocation,   setParse
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.dispatcher.ServletRedirectResult Detail:
 public ServletRedirectResult addParameter(String key,
    Object value) 
    Adds a request parameter to be added to the redirect url
 protected  void doExecute(String finalLocation,
    ActionInvocation invocation) throws Exception 
 protected List<String> getProhibitedResultParams() 
 public  void handle(ReflectionException ex) 
 protected  void sendRedirect(HttpServletResponse response,
    String finalLocation) throws IOException 
    Sends the redirection. Can be overridden to customize how the redirect is handled (i.e. to use a different status code)
 public  void setActionMapper(ActionMapper mapper) 
 public  void setPrependServletContext(boolean prependServletContext) 
    Sets whether or not to prepend the servlet context path to the redirected URL.
 public  void setStatusCode(int code) 
 public  void setSupressEmptyParameters(boolean supressEmptyParameters) 
    Sets the supressEmptyParameters option