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 var=var-name

For example:

<dsp:tomap bean="/atg/userprofiling/Profile" var="userProfile"/>

This tag creates the variable userProfile which can be used to reference all Profile component properties. The tag omits the scope attribute, so the default pageScope is applied. 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 variable. 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, <c:out value="${name}"/>!
Accessing Dynamic Beans as properties

If a dsp:tomap tag sets its recursive attribute to true, all underlying Dynamic Beans are wrapped as Maps and can be accessed through the EL variable. This can help simplify code that accesses multi-dimensional data. For example, if the RepositoryItem Profile has a property fundList which is itself a RepositoryItem, you can provide direct access to the fundList property as follows:

<dsp:tomap bean="atg/userprofiling/Profile" var="profile" recursive="true"/>
I own these mutual funds: <c:out value="${profile.fundList}"/>

If desired, you can access the underlying Dynamic Bean rather than its Map wrapper through the DynamicBeanMap property _realObject. Thus, given the previous example, you might access the Dynamic Bean fundList as follows:


loading table of contents...