Deconstructing the JSP Expression Language (EL)

The syntax and range of the language are dirt simple. The tricky part is that some of EL looks like Java, but behaves differently. You’ll see when we get to the [] operator in a moment. So you’ll find things that wouldn’t work in Java but will work in EL, and vice-versa. Just don’t try to map Java language/syntax rules onto EL, and you’ll be fine. For the next few pages, think of EL as a way to access Java objects without using Java.

EL expressions are ALWAYS within curly braces, and prefixed with the dollar sign

${person.name}

Note

The first named variable in the expression is either an implicit object or an attribute.

image with no caption

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.