JavaBean property values can themselves be JavaBeans with their own property values. You can reference nested property values in JSPs with the following syntax:
component
-
name
.
property
.
nested-property[
.
nested-property]...
property
specifies a property ofcomponent
-
name
that refers to another componentnested-property
specifies a property of the parent property
When you reference a property in a JSP, you can also reference a property of that property, with multiple levels of indirection.
For example, the JavaBean PersonManager
has the property currentPerson
. The value of this property is an instance of a Person
class object which has an age
property. A JSP can reference the age of the current person as follows:
<dsp:getvalueof value="/samples/PersonManager" var=pMgr></dsp:getvalueof>
<c:out value="${pMgr.currentPerson.age}"