org.apache.struts2.dispatcher
类 StrutsResultSupport

java.lang.Object
  继承者 org.apache.struts2.dispatcher.StrutsResultSupport
所有已实现的接口:
com.opensymphony.xwork2.Result, Serializable, StrutsStatics
直接已知子类:
FreemarkerResult, PlainTextResult, PostbackResult, ServletDispatcherResult, ServletRedirectResult, StreamResult, VelocityResult

public abstract class StrutsResultSupport
extends Object
implements com.opensymphony.xwork2.Result, StrutsStatics

A base class for all Struts action execution results. The "location" param is the default parameter, meaning the most common usage of this result would be:

This class provides two common parameters for any subclass:

NOTE: The encode param will only have effect when parse is true

In the struts.xml configuration file, these would be included as:

  <result name="success" type="redirect">
      <param name="location">foo.jsp</param>
  </result>

or

  <result name="success" type="redirect" >
      <param name="location">foo.jsp?url=${myUrl}</param>
      <param name="parse">true</param>
      <param name="encode">true</param>
  </result>

In the above case, myUrl will be parsed against Ognl Value Stack and then URL encoded.

or when using the default parameter feature

  <result name="success" type="redirect">foo.jsp</result>

You should subclass this class if you're interested in adding more parameters or functionality to your Result. If you do subclass this class you will need to override doExecute(String, ActionInvocation).

Any custom result can be defined in struts.xml as:

  <result-types>
      ...
      <result-type name="myresult" class="com.foo.MyResult" />
  </result-types>

Please see the Result class for more info on Results in general.

另请参见:
Result, 序列化表格

字段摘要
static String DEFAULT_PARAM
          The default parameter
 
从接口 org.apache.struts2.StrutsStatics 继承的字段
HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION, STRUTS_PORTLET_CONTEXT
 
构造方法摘要
StrutsResultSupport()
           
StrutsResultSupport(String location)
           
StrutsResultSupport(String location, boolean parse, boolean encode)
           
 
方法摘要
 void execute(com.opensymphony.xwork2.ActionInvocation invocation)
          Implementation of the execute method from the Result interface.
 String getLastFinalLocation()
          Returns the last parsed and encoded location value
 String getLocation()
          Gets the location it was created with, mainly for testing
 void setEncode(boolean encode)
          Set encode to true to indicate that the location should be url encoded.
 void setLocation(String location)
          The location to go to after action execution.
 void setParse(boolean parse)
          Set parse to true to indicate that the location should be parsed as an OGNL expression.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

DEFAULT_PARAM

public static final String DEFAULT_PARAM
The default parameter

另请参见:
常量字段值
构造方法详细信息

StrutsResultSupport

public StrutsResultSupport()

StrutsResultSupport

public StrutsResultSupport(String location)

StrutsResultSupport

public StrutsResultSupport(String location,
                           boolean parse,
                           boolean encode)
方法详细信息

setLocation

public void setLocation(String location)
The location to go to after action execution. This could be a JSP page or another action. The location can contain OGNL expressions which will be evaulated if the parse parameter is set to true.

参数:
location - the location to go to after action execution.
另请参见:
setParse(boolean)

getLocation

public String getLocation()
Gets the location it was created with, mainly for testing


getLastFinalLocation

public String getLastFinalLocation()
Returns the last parsed and encoded location value


setParse

public void setParse(boolean parse)
Set parse to true to indicate that the location should be parsed as an OGNL expression. This is set to true by default.

参数:
parse - true if the location parameter is an OGNL expression, false otherwise.

setEncode

public void setEncode(boolean encode)
Set encode to true to indicate that the location should be url encoded. This is set to true by default

参数:
encode - true if the location parameter should be url encode, false otherwise.

execute

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

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