O'Reilly logo

Head First Servlets and JSP, 2nd Edition by Bert Bates, Bryan Basham, Kathy Sierra

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Trying to display the property of the property

We know we can do it with scripting, but can we do it with the bean standard actions? What happens if we put “dog” as the property in the <jsp:getProperty> tag?

Without standard actions (using scripting)

image with no caption

What we WANT What we GOT

image with no caption
image with no caption

You can’t say: property=“dog.name

There’s no combination of the bean standard actions that’ll work given the original servlet code, because the Dog is not an attribute! Dog is a property of the attribute, so you can display the Dog, but you can’t navigate to the name property of the Dog property of the Person attribute.

The <jsp:getProperty> lets you access only the properties of the bean attribute. There’s no capability for nested properties, where you want a property of a property, rather than a property of the attribute.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required