WebWork 2 : Default results
This page last changed on Dec 13, 2004 by casey.
Webwork has the ability to define a default result type for your actions. Thus, you don't have to specify the result-type for results using the default. If a package extends another package and you don't specify a new default result type for the child package, then the parent package default type will be used when the type attribute is not specified in the result tag. <!-- parts of xwork.xml --> .... <result-types> <result-type name="dispatcher" class="com.opensymphony.webwork.dispatcher.ServletDispatcherResult" default="true"/> <result-type name="redirect" class="com.opensymphony.webwork.dispatcher.ServletRedirectResult"/> <result-type name="velocity" class="com.opensymphony.webwork.dispatcher.VelocityResult"/> </result-types> .... <action name="bar" class="myPackage.barAction"> <!-- this result uses dispatcher, so you can omit the type="dispatcher" if you want --> <result name="success">foo.jsp</result> <!-- this result uses velocity result, so the type needs to be specified --> <result name="error" type="velocity">error.vm</result> </action> .... |
![]() |
Document generated by Confluence on Dec 14, 2004 16:36 |