Chapter 5. JSP and EL

The previous chapters in this book demonstrated the breadth of JSP technology and introduced some basic techniques of JSP development. The aim thus far has been to provide you with some fast, hands-on experience with the JSP technology. The working examples in these earlier chapters enabled you to try out real JSP code, and see what JSP can be used for in the real world.

Unlike the earlier chapters, this chapter provides a more in-depth exploration of a cornerstone element of the JSP standard: JSP's Expression Language, or EL for short.

In this chapter, you will discover the following:

  • Why EL is an indispensable part of JSP 2.0

  • How to use EL named variables

  • How to perform type conversion and coercion in EL

  • How to handle null values in EL

  • How to work with arithmetic, logical, comparison, and other operators in EL

  • The different ways of accessing members of a collection in EL

  • How to access properties of objects in EL

  • How to access nested object properties in EL

  • How to use implicit objects in EL

  • How to define and access functions in EL

  • How to use a namespace when referencing EL functions

This chapter covers a lot of ground, and includes five separate examples. By the end of the chapter, you should be very familiar with EL, and be comfortable using it in your own applications.

EL and Its Vital Role in JSP

EL was not part of the JSP standard prior to 2.0. One of the main reasons for creating EL was to ensure that presentation-level JSP pages could be created without relying on scripting ...

Get Beginning JavaServer Pages™ 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.