The value of an array property index can also be set from a page parameter. For example, if a JSP has the page parameter latestHobby and it contains an integer value, the JSP can use that parameter as an index into the array property Student_01.hobbies:

<dsp:valueof bean="Student_01.hobbies[param:latestHobby]"/>

As with properties, you can also use EL to express the page parameter as an array index. The previous example might be modified as follows:

<dsp:getvalueof param="latestHobby" var="hobby"></dsp:getvalueof>

<dsp:param name="latestHobby" value="3"/>
<dsp:valueof bean="Student_01.hobbies[${hobby}]"/>

Note: While you can use a parameter as an array index, a parameter cannot itself be indexed.

For example, this construction is invalid:

<dsp:param name="currentStudent" value="bean:Student_01"/>
<dsp:valueof param="currentStudent.hobbies[3]"/>


Copyright © 1997, 2017 Oracle and/or its affiliates. All rights reserved. Legal Notices