You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Description

<action name="formTest" class="com.opensymphony.webwork.example.FormAction" method="processForm">

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, 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 "save" in FormAction class. The method must be public and take no arguments:

  public String save() throws Exception
  {
      ...
      return SUCCESS;
  }

All the configuration for "actionName" will be used for "actionName!something" (interceptors, result types, etc...)

Most of the content here provided by Matt Dowell <matt.dowell@notiva.com>

  • No labels