Description
Results are string constants that Actions return to indicate the status of an Action execution. A standard set of Results are defined by default: error, input, login, none and success. Developers are, of course, free to create their own Results to indicate more application specific cases. Results are mapped to defined Result Types using a name-value pair structure.
Result tags
Result tags tell WebWork what to do next after the action has been called. There are a standard set of result codes built-in to WebWork, (in the Action interface) they include:
String SUCCESS = "success"; String NONE = "none"; String ERROR = "error"; String INPUT = "input"; String LOGIN = "login";
You can extend these as you see fit. Most of the time you will have either SUCCESS or ERROR, with SUCCESS moving on to the next page in your application;
<result name="success" type="dispatcher"> <param name="location">/thank_you.jsp</param> </result>
...and ERROR moving on to an error page, or the preceding page;
<result name="error" type="dispatcher"> <param name="location">/error.jsp</param> </result>
Results are specified in a xwork xml config file(xwork.xml) nested inside <action>. If the location
param is the only param being specified in the result tag, you can simplify it as follows:
<action name="bar" class="myPackage.barAction"> <result name="success" type="dispatcher"> <param name="location">foo.jsp</param> </result> </action>
or simplified
<action name="bar" class="myPackage.barAction"> <result name="success" type="dispatcher">foo.jsp</result> </action>
or even simplified further
<action name="bar" class="myPackage.barAction"> <result>foo.jsp</result> </action>
Default Action Class
If the class attribute is not specified in the action tag, it will default to WebWork's ActionSupport.
Default Location Parameter
If no param tag eg. <param name="location"> ,,, </param> is given as child of the <result ..> tag, WebWork will assume the text enclosed within the <result> </result> tags to be the location.
Default Result Type
If no type attribute is specified in the <result ...> tag, WebWork assume the type to be dispatcher. (Analogus to Servlet's Specs. SerlvetDispatcher's forward).