JSP Expression Language (EL) - Javastudypoint

Tuesday, December 18, 2018

JSP Expression Language (EL)


In JSP standard action and custom action tags reduce java code from a JSP page. The main purpose of JSP expression language is to simplify the accessibility of data stored in java bean component. The expression language is also given to reduces the java code from a JSP page in some areas. Using the Expression language we can reduce the java code in the following areas.


Reading Request parameter, Reading cookies, Reading attributes, Accessing bean business method etc.

The Expression language is still defined within JSP 2.1 specification. It now has its own independent specification document. The addition of the EL to the JSP technology provides much the writing of script-less JSP pages. These pages can use EL expression but can't use java scriptlets, java expression or java declaration elements.

Syntax of Expression Languages in JSP pages.


There are two constructs to represent the EL Expression:

1. $ { Expression }
2. # { Expression }

An EL Expression that is evaluated immediately is represented in JSP with the syntax $ { } , While an EL expression whose evaluation is deffered is
represented with the syntax # { }.

JSP EL implicit objects.

There are quite a few implicit objects that can be exposed through the EL. These objects allow access to any variables, which are held in the particular JSP Scopes.The implicit objects include: pageScope,requestScope,sessionScope, and applicationScope.All these scope objects mentioned here are nothing but Maps that map the respective scope attributes names to their values.


The following table summarized the available implicit objects:

JSP Expression Language



EL param example:



JSP Expression Language



JSP Expression Language


Output:

JSP Expression Language


JSP Expression Language



EL applicationScope example:



JSP Expression Language




JSP Expression Language


Output:

JSP Expression Language


JSP Expression Language



EL sessionScope example:


JSP Expression Language


JSP Expression Language




JSP Expression Language



Output:
JSP Expression Language
      

JSP Expression Language


JSP Expression Language


JSP EL Relational, Logical and Arithmetic operator.

JSP Expression Language provides the support for any type of relational, logical, or arithmetic operator, which you will need to perform. Remember, all results will be boolean values.

The following table will guide you in how to use each of these operators.


JSP Expression Language



You may also like:






No comments:

Post a Comment