Setup Menus in Admin Panel

3.4 Expression Language(EL)

 Expression Language(EL)

Expression language (EL) has been introduced in JSP 2.0. The main purpose of it to simplify the process of accessing data from bean properties and from implicit objects. EL includes arithmetic, relational and logical operators too.

${expression}

whatever present inside braces gets evaluated at runtime and being sent to the output stream.

<html>
<head>
<title>Expression language example1</title>
</head>
<body>${1<2}${1+2+3}</body>
</html>

 Implicit Objects in JSP

JSP Implicit Objects are the Java objects that the JSP Container makes available to developers in each page and developer can call them directly without being explicitly declared. JSP Implicit Objects are also called pre-defined variables.

Following are the JSP implicit object

Implicit Object Description
request The HttpServletRequest object associated with the request.
response The HttpServletRequest object associated with the response that is sent back to the browser.
out The JspWriter object associated with the output stream of the response.
session The HttpSession object associated with the session for the given user of request.
application The ServletContext object for the web application.
config The ServletConfig object associated with the servlet for current JSP page.
pageContext The PageContext object that encapsulates the enviroment of a single request for this current JSP page
page The page variable is equivalent to this variable of Java programming language.
exception The exception object represents the Throwable object that was thrown by some other JSP page.

 download the example:

 EL implicit objects

JSP Expression Language provides many implicit objects that we can use to get attributes from different scopes and parameter values. The list is given below.

JSP EL Implicit Objects Type Description
pageScope Map A map that contains the attributes set with page scope.
requestScope Map Used to get the attribute value with request scope.
sessionScope Map Used to get the attribute value with session scope.
applicationScope Map Used to get the attributes value from application scope.
param Map Used to get the request parameter value, returns a single value
paramValues Map Used to get the request param values in an array, useful when request parameter contain multiple values.
header Map Used to get request header information.
headerValues Map Used to get header values in an array.
cookie Map Used to get the cookie value in the JSP
initParam Map Used to get the context initparams, we can’t use it for servlet initparams
pageContext pageContext Same as JSP implicit pageContext object, used to get the request, session references etc. example usage is getting request HTTP Method name.
January 16, 2016

0 responses on "3.4 Expression Language(EL)"

Leave a Message

Your email address will not be published. Required fields are marked *

About Us

Pradeep Academy is an online & Training institute To make learning easy, interesting, affordable and accessible to millions of learners across the Globe. To create an alternative learning platform, using a unique learning methodology of live online interactive courses along with 24x7 support. We aim to empower our customers with skills which will help them get an edge in their careers and improve their lives.

Contact Us

Address :

PradeepIT Consulting Services Pvt Ltd

205,Brigade gardens, No.19 Church Street , Bangalore – 560001, Karnataka, India

Email : [email protected]
Ph No: 08047363377
Web: https://academy.pradeepit.com
top
© Pradeep Academy.  Design & Developed by