Tag Name: <a2:action />

Description

Execute an action from within a view

This tag enables developers to call actions directly from a JSP page by specifying the action name and an optional namespace. The body content of the tag is used to render the results from the Action. Any result processor defined for this action in xwork.xml will be ignored, unless the executeResult parameter is specified.

  public class ActionTagAction extends ActionSupport { public String execute() throws Exception { return "done"; } public String doDefault() throws Exception { ServletActionContext.getRequest().setAttribute("stringByAction", "This is a String put in by the action's doDefault()"); return "done"; } }  
   ....  success.jsp   success.jsp  ....   
  
The following action tag will execute result and include it in this page


The following action tag will do the same as above, but invokes method specialMethod in action


The following action tag will not execute result, but put a String in request scope under an id "stringByAction" which will be retrieved using property tag

Attributes

Name

Required

Default

Type

Description

id false   String the id (if speficied) to put the action under stack's context.
name true   String name of the action to be executed (without the extension suffix eg. .action)
namespace false namespace from where tag is used String namespace for action to call
executeResult false false Boolean whether the result of this action (probably a view) should be executed/rendered
ignoreContextParams false false Boolean whether the request parameters are to be included when the action is invoked

Back to Taglib Index