The previous section demonstrated how a parameter can point to any object. Those objects might themselves have property values that you want to access from a JSP.

For example, say that you wanted to print the age and name properties of some object, but you do not know ahead of time what that object is. Presumably a pointer to that object is passed as a parameter—in this example, currentPerson.

The following code prints those parameter properties:

<dsp:valueof param=""></dsp:valueof> is
<dsp:valueof param="currentPerson.age"></dsp:valueof> years old.

Notice how the dsp:param tag looks like it always has, except that instead of naming a parameter, the tag names a specific property of a parameter.

This form of the dsp:param tag can be used be used to set a parameter, using param=.., or update a parameter with another parameter value as in:

<dsp:setvalue param="" paramvalue="user1"/>

This tag sets the first parameter,, to the value in the second, user1. The currentPerson page parameter maps to a component: that component’s name property takes the string value of user1. Earlier, you set currentPerson as follows:

<dsp:param name="currentPerson" bean="/db/personGetter.person">

The parameter can also be set through Java code, as outlined in the previous section.

loading table of contents...