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

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 eveluates 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 name="personName" value="person.name"/>
Hello, <s:property value="#personName"/>. How are you?

Field Summary
protected  String scope     
protected  String value     
Fields inherited from org.apache.struts2.components.ContextBean:
var
Fields inherited from org.apache.struts2.components.Component:
COMPONENT_STACK,  stack,  parameters,  actionMapper,  throwExceptionOnELFailure
Constructor:
 public Set(ValueStack stack) 
Method from org.apache.struts2.components.Set Summary:
end,   setName,   setScope,   setValue,   setVar,   usesBody
Methods from org.apache.struts2.components.ContextBean:
getVar,   putInContext,   setId,   setVar
Methods from org.apache.struts2.components.Component:
addAllParameters,   addParameter,   altSyntax,   altSyntax,   completeExpressionIfAltSyntax,   copyParams,   determineActionURL,   determineNamespace,   end,   end,   fieldError,   findAncestor,   findString,   findString,   findStringIfAltSyntax,   findValue,   findValue,   findValue,   getComponentStack,   getParameters,   getStack,   popComponentStack,   setActionMapper,   setThrowExceptionsOnELFailure,   start,   stripExpressionIfAltSyntax,   stripExpressionIfAltSyntax,   toString,   usesBody
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.struts2.components.Set Detail:
 public boolean end(Writer writer,
    String body) 
 public  void setName(String name) 
 public  void setScope(String scope) 
 public  void setValue(String value) 
 public  void setVar(String var) 
 public boolean usesBody()