org.apache.struts2.components
类 Component

java.lang.Object
  继承者 org.apache.struts2.components.Component
直接已知子类:
ContextBean, Else, ElseIf, I18n, If, Include, OptGroup, Param, Property, Push, UIBean

public class Component
extends Object

Base class to extend for UI components.

This class is a good extension point when building reuseable UI components.


字段摘要
static String COMPONENT_STACK
           
 
构造方法摘要
Component(com.opensymphony.xwork2.util.ValueStack stack)
          Constructor.
 
方法摘要
 void addAllParameters(Map params)
          Adds all the given parameters to this component's own parameters.
 void addParameter(String key, Object value)
          Adds the given key and value to this component's own parameter.
 boolean altSyntax()
          Is the altSyntax enabled?
 void copyParams(Map params)
          Pushes this component's parameter Map as well as the component itself on to the stack and then copies the supplied parameters over.
 boolean end(Writer writer, String body)
          Callback for the end tag of this component.
 Stack<Component> getComponentStack()
          Gets the component stack of this component.
 Map getParameters()
          Gets the parameters.
 com.opensymphony.xwork2.util.ValueStack getStack()
          Gets the OGNL value stack assoicated with this component.
 void setActionMapper(ActionMapper mapper)
           
 void setThrowExceptionsOnELFailure(String throwException)
           
 void setUrlHelper(UrlHelper urlHelper)
           
 boolean start(Writer writer)
          Callback for the start tag of this component.
 boolean usesBody()
          Overwrite to set if body should be used.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

COMPONENT_STACK

public static final String COMPONENT_STACK
另请参见:
常量字段值
构造方法详细信息

Component

public Component(com.opensymphony.xwork2.util.ValueStack stack)
Constructor.

参数:
stack - OGNL value stack.
方法详细信息

setActionMapper

public void setActionMapper(ActionMapper mapper)

setThrowExceptionsOnELFailure

public void setThrowExceptionsOnELFailure(String throwException)

setUrlHelper

public void setUrlHelper(UrlHelper urlHelper)

getStack

public com.opensymphony.xwork2.util.ValueStack getStack()
Gets the OGNL value stack assoicated with this component.

返回:
the OGNL value stack assoicated with this component.

getComponentStack

public Stack<Component> getComponentStack()
Gets the component stack of this component.

返回:
the component stack of this component, never null.

start

public boolean start(Writer writer)
Callback for the start tag of this component. Should the body be evaluated?

参数:
writer - the output writer.
返回:
true if the body should be evaluated

end

public boolean end(Writer writer,
                   String body)
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

参数:
writer - the output writer.
body - the rendered body.
返回:
true if the body should be evaluated again

altSyntax

public boolean altSyntax()
Is the altSyntax enabled? [TRUE]

See struts.properties where the altSyntax flag is defined.


copyParams

public void copyParams(Map params)
Pushes this component's parameter Map as well as the component itself on to the stack and then copies the supplied parameters over. Because the component's parameter Map is pushed before the component itself, any key-value pair that can't be assigned to componet will be set in the parameters Map.

参数:
params - the parameters to copy.

getParameters

public Map getParameters()
Gets the parameters.

返回:
the parameters. Is never null.

addAllParameters

public void addAllParameters(Map params)
Adds all the given parameters to this component's own parameters.

参数:
params - the parameters to add.

addParameter

public void addParameter(String key,
                         Object value)
Adds the given key and value to this component's own parameter.

If the provided key is null nothing happens. If the provided value is null any existing parameter with the given key name is removed.

参数:
key - the key of the new parameter to add.
value - the value assoicated with the key.

usesBody

public boolean usesBody()
Overwrite to set if body should be used.

返回:
always false for this component.