EL Expression Types and Usage

This section describes EL expression types and their usage. Rvalue Immediate Evaluated Value expressions are commonly used in JSP pages mixed in static text and tag attributes.

According to the EL 2.1 specification, an EL expression can be grouped in 3 ways:

Most commonly used EL expressions in JSP pages are Rvalue Immediate Evaluated Value expressions (Immediate Evaluation Expression, Value Expression and Rvalue Expression), which are expressed as:

${expression}

Since JSP 2.0, Rvalue Immediate Evaluated Value EL expressions can be used in 2 areas in JSP pages:

1. Using EL in Static Text - EL expressions can be used anywhere in the static text. Values resulted from EL expressions will be converted to String and inserted into the static text. For example, hello_el.jsp:

<html><body>
${"Hello world! - From EL"}
</body></html>

2. Using EL in Tag Attributes - EL expressions can be used any tag attributes where expression is accepted. Values resulted from EL expressions will be passed to the tag class to determine how it will be used. For example, hello_tag_el.jsp:

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html><body>
<c:out value="${'Hello world! - From Tag EL'}"/>
</body></html>

In this chapter, we will concentrate on using EL expressions in static text to learn basic elements of EL expressions.

Last update: 2012.

Table of Contents

 About This Book

 JSP (JavaServer Pages) Overview

 Tomcat 7 Installation on Windows Systems

 JSP Scripting Elements

 Java Servlet Introduction

 JSP Implicit Objects

 Syntax of JSP Pages and JSP Documents

 JSP Application Session

 Managing Cookies in JSP Pages

 JavaBean Objects and "useBean" Action Elements

 Managing HTTP Response Header Lines

 Non-ASCII Characters Support in JSP Pages

 Performance of JSP Pages

EL (Expression Language)

 What is EL (Expression Language)?

EL Expression Types and Usage

 Literal Data and Named Variables

 Basic Operators and Operations

 Predefined Implicit Objects

 Collection Elements and Object Properties

 Expression Examples in Static Text

 Expression Examples in Static Text - Result

 EL Variables Are pageContext Attributes

 Overview of JSTL (JSP Standard Tag Libraries)

 JSTL Core Library

 JSP Custom Tags

 JSP Java Tag Interface

 Custom Tag Attributes

 Multiple Tags Working Together

 File Upload Test Application

 Outdated Tutorials

 References

 PDF Printing Version