Creates an EL variable that references the specified component property or page parameter.
<dsp:getvalueofsource-value
var-spec
[data-type]
</getvalueof>
Attributes
source-value
Specifies the value sources as a JavaBean component, Page parameter, or Static value, as follows:
bean="
nucleus-path/c
omponent
-name
"
param="
param-name
"
value="
static-value
"
var-spec
An EL variable or scripting variable that is defined with one of these attributes:
Attribute | Description |
---|---|
| Names an EL variable. When you use |
| Names a scripting variable that scriptlets and expressions can access at runtime. |
data-type
By default, the variable that is created by dsp:getvalue
is of type java.lang.Object
. You can set the variable to a different type through the vartype
and idtype
attributes, which qualify the var
and id
attributes, respectively. For example, if you set the EL variable to a page parameter that holds a string, set its vartype
attribute to java.lang.String
. This enables the returned value to execute string-specific methods without explicit typecasting.
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.