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

Expression Language (EL) saves the day!

Yes, just in time to save us, the JSP Expression Language (EL) was added to the JSP 2.0 spec, releasing us from the tyranny of scripting.

Look how beautifully simple our JSP is now...

JSP code without scripting, using EL

<html><body>
Dog's name is: ${person.dog.name}
</body></html>

Note

This is it! We didn’t even declare what person means... it just knows.

Note

EL makes it easy to print nested properties... in other words, properties of properties!

This:

${person.dog.name}

Replaces this:

<%= ((foo.Person) request.getAttribute("person")).getDog().getName() %>

Relax

You don’t need to know EVERYTHING about EL.

The exam doesn’t expect you to be a complete EL being. Everything you might typically use, or be tested on, is covered in the next few pages. So, if you want to study the EL spec, knock yourself out. Just so you’re clear that WE didn’t tell you to do that.

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