Creates an EL variable that references the specified component property or page parameter.

<dsp:getvalueof
   source-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/component-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

var

Names an EL variable. When you use var, you can set its scope attribute to page, request, session, or application. The default scope is page. For more information, see EL Variable Scopes in Chapter 2.

id

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.

 
loading table of contents...