org.apache.struts2.components
类 Set

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

public class Set
extends ContextBean

The set tag assigns a value to a variable in a specified scope. It is useful when you wish to assign a variable to a complex expression and then simply reference that variable each time rather than the complex expression. This is useful in both cases: when the complex expression takes time (performance improvement) or is hard to read (code readability improvement).

If the tag is used with body content, the evaluation of the value parameter is omitted. Instead, the String to which the body evaluates is set as value for the scoped variable.

The scopes available are as follows :- NOTE:

If no scope is specified, it will default to action scope.

Parameters

Examples

 
 <s:set var="personName" value="person.name"/>
 Hello, <s:property value="#personName"/>

 <s:set var="janesName">Jane Doe</s:set>
 <s:property value="#janesName"/>
 
 


字段摘要
 
从类 org.apache.struts2.components.Component 继承的字段
COMPONENT_STACK
 
构造方法摘要
Set(com.opensymphony.xwork2.util.ValueStack stack)
           
 
方法摘要
 boolean end(Writer writer, String body)
          Callback for the end tag of this component.
 void setName(String name)
           
 void setScope(String scope)
           
 void setValue(String value)
           
 void setVar(String var)
           
 boolean usesBody()
          Overwrite to set if body should be used.
 
从类 org.apache.struts2.components.ContextBean 继承的方法
setId
 
从类 org.apache.struts2.components.Component 继承的方法
addAllParameters, addParameter, altSyntax, copyParams, getComponentStack, getParameters, getStack, setActionMapper, setThrowExceptionsOnELFailure, setUrlHelper, start
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

Set

public Set(com.opensymphony.xwork2.util.ValueStack stack)
方法详细信息

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

setVar

public void setVar(String var)
覆盖:
ContextBean 中的 setVar

setName

public void setName(String name)

setScope

public void setScope(String scope)

setValue

public void setValue(String value)

usesBody

public boolean usesBody()
从类 Component 复制的描述
Overwrite to set if body should be used.

覆盖:
Component 中的 usesBody
返回:
always false for this component.