dsp:getvalueof
creates an EL variable that references the specified component property or page parameter. Tags nested within dsp:getvalueof
can access this variable.
Attributes
TagVariable:varorid(Required)
You must define an EL variable or scripting variable:
Attribute | Description |
---|---|
| Names an EL variable. When you use |
| Names a scripting variable, which scriptlets and expressions can access at runtime. The |
VariableScope:scope
The scope
attribute determines what resources can access the named EL variable. Options include: page
, request
, session
, or application
. Omitting this attribute causes the default, page
, to be used.
SourceValue:beanorparam(Required)
Provide a bean property or a page parameter to be referenced by the named EL variable.
Attribute | Description |
---|---|
| Property with the value to be referenced by the EL variable. Should include Nucleus path, component, and property name. |
| Page parameter with the value to be referenced by the EL variable. |
DataType:idtypeorvartype
If you want the returned item to be a value that is a data type other than java.lang.Object
, set that type to the vartype
attribute. For example, if you set the EL variable to a page parameter that holds a string, set the vartype
to java.lang.String
so the returned value can execute string-specific methods without explicit typecasting in the future. The returned value must be assignable to the idtype
you specify.
Attribute | Description |
---|---|
| Specifies a data type for the object referenced by the EL variable. |
| Specifies a data type for the object referenced by the scripting variable. |
Example
<dsp:getvalueof var="backgroundcolor" bean="Profile.preferredColor"
vartype="java.lang.String">
<body bgcolor="${backgroundcolor}" >
</dsp:getvalueof>
In this example, the tag sets the backgroundcolor
attribute to the value held by the preferredColor
property of the Profile
component. The preferredColor
value is kept as a String. The EL variable renders the backgroundcolor
value so the current page background color is set to it. This code sample uses the DSP and JSTL Core tag libraries.