dsp:tomap
provides access to Dynamic Bean components, standard JavaBean components, page parameters, and values by other tags that use EL or scripting variables. When you pass a parameter, component, or other value to a dsp:tomap
tag, the object that is referenced by the EL or scripting variable treats the input as a Map. For example, when you pass in a component, the component appears as a Map in which the properties are keys and the property values are values.
You must use dsp:tomap
in order to access a repository item in an EL expression.
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. |
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:bean,param,orvalue(Required)
Set the variable to a RepositoryItem
bean, page parameter, or constant value that can be retrieved be other tags.
Attribute | Description |
---|---|
| Bean or bean and property that is processed by |
| Page parameter that is processed by |
| Value that is processed by |
Example
<dsp:tomap var="currentProfile" bean="Profile"/>
<dsp:tomap var="address" bean="Profile.homeAddress"/>
Hello <c:out value="${currentProfile.firstName}"/>
Do you still live in <c:out value="${address.city}"/>
In this example, the Profile
component is saved to the object referenced by currentProfile
so Profile.firstName
and Profile.homeAddress.city
other tags can use EL to render them.