Save This Page
Home » struts-2.0.11.2-src » org.apache » struts2 » components » [javadoc | source]
org.apache.struts2.components
public class: ActionComponent [javadoc | source]
java.lang.Object
   org.apache.struts2.components.Component
      org.apache.struts2.components.ActionComponent

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 struts.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
Field Summary
protected  HttpServletResponse res     
protected  HttpServletRequest req     
protected  ActionProxyFactory actionProxyFactory     
protected  ActionProxy proxy     
protected  String name     
protected  String namespace     
protected  boolean executeResult     
protected  boolean ignoreContextParams     
protected  boolean flush     
Fields inherited from org.apache.struts2.components.Component:
COMPONENT_STACK,  stack,  parameters,  id,  actionMapper
Constructor:
 public ActionComponent(ValueStack stack,
    HttpServletRequest req,
    HttpServletResponse res) 
Method from org.apache.struts2.components.ActionComponent Summary:
end,   getProxy,   setActionProxyFactory,   setExecuteResult,   setFlush,   setIgnoreContextParams,   setName,   setNamespace
Methods from org.apache.struts2.components.Component:
addAllParameters,   addParameter,   altSyntax,   copyParams,   determineActionURL,   determineActionURL,   determineNamespace,   end,   end,   fieldError,   findAncestor,   findString,   findString,   findValue,   findValue,   findValue,   getComponentStack,   getId,   getParameters,   getStack,   popComponentStack,   setActionMapper,   setId,   start,   toString,   usesBody
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.components.ActionComponent Detail:
 public boolean end(Writer writer,
    String body) 
 public ActionProxy getProxy() 
 public  void setActionProxyFactory(ActionProxyFactory actionProxyFactory) 
 public  void setExecuteResult(boolean executeResult) 
 public  void setFlush(boolean flush) 
 public  void setIgnoreContextParams(boolean ignoreContextParams) 
 public  void setName(String name) 
 public  void setNamespace(String namespace)