| java.lang.Object com.opensymphony.webwork.dispatcher.WebWorkResultSupport
All known Subclasses: com.opensymphony.webwork.dispatcher.ServletDispatcherResult, com.opensymphony.webwork.dispatcher.StreamResult, com.opensymphony.webwork.views.freemarker.PortletFreemarkerResult, com.opensymphony.webwork.dispatcher.ServletRedirectResult, com.opensymphony.webwork.portlet.result.PortletResult, com.opensymphony.webwork.views.jasperreports.JasperReportsResult, com.opensymphony.webwork.views.freemarker.FreemarkerResult, com.opensymphony.webwork.dispatcher.VelocityResult, com.opensymphony.webwork.portlet.result.PortletVelocityResult, com.opensymphony.webwork.dispatcher.PlainTextResult,
WebWorkResultSupport | abstract public class WebWorkResultSupport implements Result,WebWorkStatics(Code) | |
A base class for all WebWork 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:
- location - the location to go to after execution (could be a jsp page or another action).
It can be parsed as per the rules definied in the
TextParseUtil.translateVariables(java.lang.Stringcom.opensymphony.xwork.util.OgnlValueStack) translateVariables method
- parse - true by default. If set to false, the location param will not be parsed for expressions
- encode - false by default. If set to false, the location param will not be url encoded. This only have effect when parse is true
NOTE:
The encode param will only have effect when parse is true
In the xwork.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
WebWorkResultSupport.doExecute(String,ActionInvocation) .
Any custom result can be defined in xwork.xml as:
<result-types>
...
<result-type name="myresult" class="com.foo.MyResult" />
</result-types>
Please see the
com.opensymphony.xwork.Result class for more info on Results in general.
author: Jason Carreira author: Bill Lynch (docs) author: tm_jee See Also: com.opensymphony.xwork.Result |
Method Summary | |
protected String | conditionalParse(String param, ActionInvocation invocation) | abstract protected void | doExecute(String finalLocation, ActionInvocation invocation) Executes the result given a final location (jsp page, action, etc) and the action invocation
(the state in which the action was executed). | public void | execute(ActionInvocation invocation) Implementation of the execute method from the Result interface. | public void | setEncode(boolean encode) Set encode to true to indicate that the location should be url encoded. | public void | setLocation(String location) The location to go to after action execution. | public void | setParse(boolean parse) Set parse to true to indicate that the location should be parsed as an OGNL expression. |
encode | protected boolean encode(Code) | | |
parse | protected boolean parse(Code) | | |
doExecute | abstract protected void doExecute(String finalLocation, ActionInvocation invocation) throws Exception(Code) | | Executes the result given a final location (jsp page, action, etc) and the action invocation
(the state in which the action was executed). Subclasses must implement this class to handle
custom logic for result handling.
Parameters: finalLocation - the location (jsp page, action, etc) to go to. Parameters: invocation - the execution state of the action. throws: Exception - if an error occurs while executing the result. |
setEncode | public void setEncode(boolean encode)(Code) | | Set encode to true to indicate that the location should be url encoded. This is set to
true by default
Parameters: encode - true if the location parameter should be url encode, false otherwise. |
setLocation | public void setLocation(String location)(Code) | | 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.
Parameters: location - the location to go to after action execution. See Also: WebWorkResultSupport.setParse(boolean) |
setParse | public void setParse(boolean parse)(Code) | | Set parse to true to indicate that the location should be parsed as an OGNL expression. This
is set to true by default.
Parameters: parse - true if the location parameter is an OGNL expression, false otherwise. |
|
|