JSP EL Implicit Objects

Apart from operators, JSP also provide expression language implicit objects. The role of these implicit objects is to get the attribute associated with various object. Here, is the list of expression language implicit objects with their purposes.

Implicit Object

                               Description

requestScope

Fetches the attribute associated with request object.

sessionScope

Fetches the attribute associated with session object.

pageScope

It provides the attribute associate within pageScope.

applicationScope

Fetches the attribute associated with application object.

param

It retrieves the single value associated with request parameter.

paramValues

It retrieves the array of values associated with request parameter.

header

It retrieves the single value associated with header parameter.

headerValues

It retrieves the array of values associated with header parameter.

cookie

It is used to get the value of cookies.

initParam

It is used to map an initialize parameter.

pageContext

The role of this object is similar to JSP pageContext implicit object.

Example of Expression Language Implicit Object

This example shows the way of using various expression language implicit objects.

index.jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Tutorial and Example</title>
</head>
<body>
<%
request.setAttribute("Tutorial", "Java");
application.setAttribute("Tutorial", "Python");
request.getSession().setAttribute("Tutorial", "PHP");
%>
<center>
Host name:
${header["host"]} <br>
Path name:
${pageContext.request.contextPath} <br>
Tutorials: <br>
${requestScope.Tutorial} <br>
${applicationScope.Tutorial} <br>
${sessionScope.Tutorial} <br>
</center>
</body>
</html>
Output: