org.apache.struts2.dispatcher
类 ServletRedirectResult

java.lang.Object
  继承者 org.apache.struts2.dispatcher.StrutsResultSupport
      继承者 org.apache.struts2.dispatcher.ServletRedirectResult
所有已实现的接口:
com.opensymphony.xwork2.Result, com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler, Serializable, StrutsStatics
直接已知子类:
ServletActionRedirectResult

public class ServletRedirectResult
extends StrutsResultSupport
implements com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler

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:
 
 <!--
   The redirect URL generated will be:
   /foo.jsp#FRAGMENT
 -->
 <result name="success" type="redirect">
   <param name="location">foo.jsp</param>
   <param name="parse">false</param>
   <param name="anchor">FRAGMENT</param>
 </result>
 
 

另请参见:
序列化表格

字段摘要
 
从类 org.apache.struts2.dispatcher.StrutsResultSupport 继承的字段
DEFAULT_PARAM
 
从接口 org.apache.struts2.StrutsStatics 继承的字段
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT
 
构造方法摘要
ServletRedirectResult()
           
ServletRedirectResult(String location)
           
ServletRedirectResult(String location, String anchor)
           
 
方法摘要
 ServletRedirectResult addParameter(String key, Object value)
          Adds a request parameter to be added to the redirect url
 void execute(com.opensymphony.xwork2.ActionInvocation invocation)
          Implementation of the execute method from the Result interface.
 void handle(com.opensymphony.xwork2.util.reflection.ReflectionException ex)
           
 void setActionMapper(ActionMapper mapper)
           
 void setAnchor(String anchor)
          Set the optional anchor value.
 void setPrependServletContext(boolean prependServletContext)
          Sets whether or not to prepend the servlet context path to the redirected URL.
 void setStatusCode(int code)
           
 void setSuppressEmptyParameters(boolean suppressEmptyParameters)
          Sets the suppressEmptyParameters option
 void setUrlHelper(UrlHelper urlHelper)
           
 
从类 org.apache.struts2.dispatcher.StrutsResultSupport 继承的方法
getLastFinalLocation, getLocation, setEncode, setLocation, setParse
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ServletRedirectResult

public ServletRedirectResult()

ServletRedirectResult

public ServletRedirectResult(String location)

ServletRedirectResult

public ServletRedirectResult(String location,
                             String anchor)
方法详细信息

setActionMapper

public void setActionMapper(ActionMapper mapper)

setUrlHelper

public void setUrlHelper(UrlHelper urlHelper)

setStatusCode

public void setStatusCode(int code)

setAnchor

public void setAnchor(String anchor)
Set the optional anchor value.

参数:
anchor -

setPrependServletContext

public void setPrependServletContext(boolean prependServletContext)
Sets whether or not to prepend the servlet context path to the redirected URL.

参数:
prependServletContext - true to prepend the location with the servlet context path, false otherwise.

execute

public void execute(com.opensymphony.xwork2.ActionInvocation invocation)
             throws Exception
从类 StrutsResultSupport 复制的描述
Implementation of the execute method from the Result interface. This will call the abstract method StrutsResultSupport.doExecute(String, ActionInvocation) after optionally evaluating the location as an OGNL evaluation.

指定者:
接口 com.opensymphony.xwork2.Result 中的 execute
覆盖:
StrutsResultSupport 中的 execute
参数:
invocation - the execution state of the action.
抛出:
Exception - if an error occurs while executing the result.

setSuppressEmptyParameters

public void setSuppressEmptyParameters(boolean suppressEmptyParameters)
Sets the suppressEmptyParameters option

参数:
suppressEmptyParameters - The new value for this option

addParameter

public ServletRedirectResult addParameter(String key,
                                          Object value)
Adds a request parameter to be added to the redirect url

参数:
key - The parameter name
value - The parameter value

handle

public void handle(com.opensymphony.xwork2.util.reflection.ReflectionException ex)
指定者:
接口 com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler 中的 handle