org.apache.struts2.components
类 ActionComponent

java.lang.Object
  继承者 org.apache.struts2.components.Component
      继承者 org.apache.struts2.components.ContextBean
          继承者 org.apache.struts2.components.ActionComponent

public class ActionComponent
extends ContextBean

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


字段摘要
 
从类 org.apache.struts2.components.Component 继承的字段
COMPONENT_STACK
 
构造方法摘要
ActionComponent(com.opensymphony.xwork2.util.ValueStack stack, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
           
 
方法摘要
 boolean end(Writer writer, String body)
          Callback for the end tag of this component.
 com.opensymphony.xwork2.ActionProxy getProxy()
           
 void setActionMapper(ActionMapper mapper)
           
 void setActionProxyFactory(com.opensymphony.xwork2.ActionProxyFactory actionProxyFactory)
           
 void setExecuteResult(boolean executeResult)
           
 void setFlush(boolean flush)
           
 void setIgnoreContextParams(boolean ignoreContextParams)
           
 void setName(String name)
           
 void setNamespace(String namespace)
           
 void setRethrowException(boolean rethrowException)
           
 void setValueStackFactory(com.opensymphony.xwork2.util.ValueStackFactory valueStackFactory)
           
 
从类 org.apache.struts2.components.ContextBean 继承的方法
setId, setVar
 
从类 org.apache.struts2.components.Component 继承的方法
addAllParameters, addParameter, altSyntax, copyParams, getComponentStack, getParameters, getStack, setThrowExceptionsOnELFailure, setUrlHelper, start, usesBody
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ActionComponent

public ActionComponent(com.opensymphony.xwork2.util.ValueStack stack,
                       javax.servlet.http.HttpServletRequest req,
                       javax.servlet.http.HttpServletResponse res)
方法详细信息

setActionProxyFactory

public void setActionProxyFactory(com.opensymphony.xwork2.ActionProxyFactory actionProxyFactory)
参数:
actionProxyFactory - the actionProxyFactory to set

setValueStackFactory

public void setValueStackFactory(com.opensymphony.xwork2.util.ValueStackFactory valueStackFactory)

setActionMapper

public void setActionMapper(ActionMapper mapper)
覆盖:
Component 中的 setActionMapper

end

public boolean end(Writer writer,
                   String body)
从类 Component 复制的描述
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

覆盖:
Component 中的 end
参数:
writer - the output writer.
body - the rendered body.
返回:
true if the body should be evaluated again

getProxy

public com.opensymphony.xwork2.ActionProxy getProxy()

setName

public void setName(String name)

setNamespace

public void setNamespace(String namespace)

setExecuteResult

public void setExecuteResult(boolean executeResult)

setIgnoreContextParams

public void setIgnoreContextParams(boolean ignoreContextParams)

setFlush

public void setFlush(boolean flush)

setRethrowException

public void setRethrowException(boolean rethrowException)