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

The [] operator is like the dot only way better

The dot operator works only when the thing on the right is a bean property or map key for the thing on the left. That’s it. But the [ ] operator is a lot more powerful and flexible...

This:

${person["name"]}

Is the same as this:

${person.name}
image with no caption

The simple dot operator version works because person is a bean, and name is a property of person.

But what if person is an array?

Or what if person is a List?

Or what if name is something that can’t be expressed with the normal Java naming rules?

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