Package org.apache.struts2.result
Class ServletDispatcherResult
java.lang.Object
org.apache.struts2.result.StrutsResultSupport
org.apache.struts2.result.ServletDispatcherResult
- All Implemented Interfaces:
Serializable
,Result
,StrutsStatics
Includes or forwards to a view (usually a jsp). Behind the scenes Struts will use a RequestDispatcher, where the target servlet/JSP receives the same request/response objects as the original servlet/JSP. Therefore, you can pass data between them using request.setAttribute() - the Struts action is available.
There are three possible ways the result can be executed:
- If we are in the scope of a JSP (a PageContext is available), PageContext's
include
method is called. - If there is no PageContext and we're not in any sort of include (there is no
RequestDispatcher.INCLUDE_SERVLET_PATH
in the request attributes), then a call toforward
is made. - Otherwise,
include
is called.
This result type takes the following parameters:
- location (default) - the location to go to after execution (ex. jsp).
- parse - true by default. If set to false, the location param will not be parsed for Ognl expressions.
Example:
<result name="success" type="dispatcher"> <param name="location">foo.jsp</param> </result>
This result follows the same rules from StrutsResultSupport
.
- See Also:
-
RequestDispatcher
- Serialized Form
-
Field Summary
Fields inherited from class org.apache.struts2.result.StrutsResultSupport
DEFAULT_PARAM, DEFAULT_URL_ENCODING, parseLocation
Fields inherited from interface org.apache.struts2.StrutsStatics
ACTION_MAPPING, HTTP_REQUEST, HTTP_RESPONSE, PAGE_CONTEXT, SERVLET_CONTEXT, SERVLET_DISPATCHER, STRUTS_ACTION_TAG_INVOCATION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
doExecute
(String finalLocation, ActionInvocation invocation) Dispatches to the given location.protected HttpParameters
getParameters
(ActionInvocation invocation) void
setQueryStringParser
(QueryStringParser queryStringParser) Methods inherited from class org.apache.struts2.result.StrutsResultSupport
conditionalParse, conditionalParseCollection, execute, getLastFinalLocation, getLocation, setEncode, setLocation, setParse
-
Constructor Details
-
ServletDispatcherResult
public ServletDispatcherResult() -
ServletDispatcherResult
-
-
Method Details
-
setQueryStringParser
-
doExecute
Dispatches to the given location. Does its forward via a RequestDispatcher. If the dispatch fails a 404 error will be sent back in the http response.- Specified by:
doExecute
in classStrutsResultSupport
- Parameters:
finalLocation
- the location to dispatch to.invocation
- the execution state of the action- Throws:
Exception
- if an error occurs. If the dispatch fails the error will go back via the HTTP request.
-
getParameters
-