Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Result Types are classes that determine what happens after an Action executes and a Result is returned. Developers are free to create their own Result Types according to the needs of their application or environment. In WebWork 2 for example, Servlet and Velocity Result Types have been created to handle rendering views in web applications.

Note: All built in webwork result types implement the com.opensymphony.xwork.Result interface, which represents a generic interface for all action execution results, whether that be displaying a webpage, generating an email, sending a JMS message, etc.

Result types define classes and map them to names to be referred in the action configuration results. This serves as a shorthand name-value pair for these classes.

...

Webwork provides several implementations of the com.opensymphony.xwork.Result interface to make web-based interactions with your actions simple. These result types include:

Result Type

name

class

#Dispatcher

dispatcher

com.opensymphony.webwork.dispatcher.ServletDispatcherResult

#Redirect

redirect

com.opensymphony.webwork.dispatcher.ServletRedirectResult

#Action Chaining

chain

com.opensymphony.xwork.ActionChainResult

#Velocity

velocity

com.opensymphony.webwork.dispatcher.VelocityResult

#FreeMarker

freemarker

com.opensymphony.webwork.views.freemarker.FreemarkerResult

#JasperReports

jasper

com.opensymphony.webwork.views.jasperreports.JasperReportsResult

#XML/XSL

xslt

com.opensymphony.webwork.views.xslt.XSLTResult

#HttpHeader

 

com.opensymphony.webwork.dispatcher.HttpHeaderResult

...

Code Block
<action name="bar" class="myPackage.barAction">
  <result name="success" type="dispatcher">foo.jsp</result>
</action>

NOTE: The Parse attribute enables the location element to be parsed for expressions. An example of how this could be useful:

Code Block
<result name="success" type="redirect">/displayCart.action?userId=${userId}</result>

NOTE: You can also specify global-results to use with multiple actions. This can save time from having to add the same result to many different actions. For more information on result tags and global-results, see Results and global-results

Dispatcher
Anchor
Dispatcher
Dispatcher

...