After action executes business logic, <result > tag is used to display the View.
Struts2 provides or supports to 11 types of Results:
- redirect action
- Redirect Result
- Redirect Action Result
- Stream Result
- XSL Result
- PlainText Result
Result types are configured within the <package> tag.
"type" attribute is used to configure an action that will execute a result. "name" attribute provides a unique identifier, "class" attribute provides the implementation class for the result type and "default" attribute allows changes in the default result type.
If no attribute is specified, default type "dispatcher" is used to dispatch to JSP pages.
One can custom create their own Result types and configure them in web application.
There are also other ways to render results:
Result type is linked to View. Besides the "type" attribute and default type "dispatcher" attribute, there are three other technologies that can replace JSPs in a Struts2 application:
- Velocity Templates
- Freemarker Templates
- XSLT Transformations