Versions Compared

Key

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

...

Actions are the basic "unit-of-work" in WebWork, they define, well, actions. An action will usually be a request, (and usually a button click, or form submit). The main action element (tag is too synonymous with JSP) has two parts, the friendly name (referenced in the URL, i.e. saveForm.action) and the corresponding "handler" class.

The optional "method" parameter tells WebWork which method to call based upon this action. If you leave the method parameter blank, WebWork will call the method execute() by default. If there is no execute() method and no method specified in the xml file, WebWork will throw an exception.

Also, if you use ServletDispatcher to map your actions, you can tell WebWork to invoke "doSomething" method in your action by using the pattern "actionName!something" in your form. For example, "formTest!save.action" will invoke the method "doSave" in FormAction class. The method must be public and take no arguments:

...

Result tags tell WebWork what to do next after the action has been called. The "name" attribute maps to the result code returned from the action execute() method. The "type" attribute indicates what result type class to use (see Result + Types). The "param" elements allow you to pass parameters to
the view:

...

Code Block
<result name="missing-data" type="dispatcher">/form.jsp</result>

See webwork-default.xml or Result + Types for standard result types.

...