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...



Is the same as this:

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?

Get Head First Servlets and JSP, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.