org.apache.struts2.components
Class Set

java.lang.Object
  extended by org.apache.struts2.components.Component
      extended by org.apache.struts2.components.Set

public class Set
extends Component

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).

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  java.lang.String name
           
protected  java.lang.String scope
           
protected  java.lang.String value
           
 
Fields inherited from class org.apache.struts2.components.Component
COMPONENT_STACK, id, parameters, stack
 
Constructor Summary
Set(com.opensymphony.xwork2.util.OgnlValueStack stack)
           
 
Method Summary
 boolean end(java.io.Writer writer, java.lang.String body)
          Callback for the end tag of this component.
 void setName(java.lang.String name)
          The name of the new variable that is assigned the value of value
 void setScope(java.lang.String scope)
          The scope in which to assign the variable.
 void setValue(java.lang.String value)
          The value that is assigned to the variable named name
 
Methods inherited from class org.apache.struts2.components.Component
addAllParameters, addParameter, altSyntax, copyParams, determineActionURL, determineNamespace, end, fieldError, findAncestor, findString, findString, findValue, findValue, findValue, getComponentStack, getId, getParameters, getStack, popComponentStack, setId, start, toString, usesBody
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

scope

protected java.lang.String scope

value

protected java.lang.String value
Constructor Detail

Set

public Set(com.opensymphony.xwork2.util.OgnlValueStack stack)
Method Detail

end

public boolean end(java.io.Writer writer,
                   java.lang.String body)
Description copied from class: Component
Callback for the end tag of this component. Should the body be evaluated again?

NOTE: will pop component stack.

Overrides:
end in class Component
Parameters:
writer - the output writer.
body - the rendered body.
Returns:
true if the body should be evaluated again

setName

public void setName(java.lang.String name)
The name of the new variable that is assigned the value of value


setScope

public void setScope(java.lang.String scope)
The scope in which to assign the variable. Can be application, session, request, page, or action.


setValue

public void setValue(java.lang.String value)
The value that is assigned to the variable named name



Copyright © 2000-2006 Apache Software Foundation. All Rights Reserved.