dsp:tomap can save any dynamic value—JavaBean, Dynamic Bean or page parameter—as an EL variable. dsp:tomap
has the following syntax:
<dsp:tomap bean="nucleus-path
/component-name
.property
[.property
]... var="userProfile" [scope="scope-spec
"] ] />
For example:
<dsp:tomap bean="/atg/userprofiling/Profile" var="userProfile"/>
This tag creates the attribute userProfile
which can be used to reference all Profile
component properties. Because the scope
attribute is excluded, the attribute is defined as part of pageScope
. You can render this value later on the page as follows:
Welcome back, <c:out value="${userProfile.firstName}"/>!
Mapping to properties
In the previous example, the firstName
property is referenced through the userProfile
attribute. dsp:tomap
also lets you set an EL variable to a component property, enabling direct access to the property itself:
<dsp:tomap bean="/atg/userprofiling/Profile.firstName" var="name"/> Welcome back, ${name}!
Accessing Dynamic Beans as properties
If the property to access is a Dynamic Bean, you must make it accessible as an EL variable. For example, if the RepositoryItem Profile
has a property fundList
which is itself a RepositoryItem, you must use dsp:tomap
to map the fundList
property to an EL variable:
<dsp:tomap bean="atg/userprofiling/Profile.fundList" var="myFunds"/> I own these mutual funds: ${myFunds}