...
Code Block | ||
---|---|---|
| ||
<result-types> public Result <result-type name="dispatcher" default="true" class="org.apache.struts2.dispatcher.ServletDispatcherResult" /> </result-types>runAction() { ServletDispatcherResult result = new ServletDispatcherResult(); result.setLocation("input-form.jsp"); return result; } |
If a type
attribute is not specified, the framework will use the default dispatcher
type, which forwards to another web resource. If the resource is a JavaServer Page, then the container will render it, using its JSP engine.
...
See Parameters in configuration results for an expanded discussion.
Returning Result Objects
Instead of configuring results and returning the name, it is possible to return a result object:
Code Block | ||
---|---|---|
| ||
public Result runAction() {
ServletDispatcherResult result = new ServletDispatcherResult();
result.setLocation("input-form.jsp");
return result;
} |