0% found this document useful (0 votes)
18 views

Expression Language

The Expression Language (EL) is a simple language for accessing data in web applications. EL expressions are written within JSP pages using ${expression} syntax and are evaluated at runtime to display data. EL allows accessing literals, variables, object properties, implicit objects like request parameters, and performing operations like arithmetic, logical, and relational expressions. Custom functions can also be implemented and registered for use in EL expressions.

Uploaded by

api-3775545
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPS, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Expression Language

The Expression Language (EL) is a simple language for accessing data in web applications. EL expressions are written within JSP pages using ${expression} syntax and are evaluated at runtime to display data. EL allows accessing literals, variables, object properties, implicit objects like request parameters, and performing operations like arithmetic, logical, and relational expressions. Custom functions can also be implemented and registered for use in EL expressions.

Uploaded by

api-3775545
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPS, PDF, TXT or read online on Scribd
You are on page 1/ 15

Expression Language

 What is EL?
The JSP Expression Language(EL) is
simple, special purpose language
designed for the web application
environment. EL was originally
developed in connection with JSP
standard Tag Library but not it has
been incorporated in JSP 2.0.
 EL Syntax
${expression}

Whatever is inside the curly braces


is evaluated at runtime and sent to
the JSO output stream in place of
${}. You can use an expression as
the entire value of an attribute.
 Literals and Variables
 boolean ${true} and ${false}
 integers ${68412}
 floating point numbers with a decimal
point ${3.141}
 string enclosed either with quotation
marks ${“hello”}
 The null value ${null}
 Implicit objects
 pageContext
 pageScope
 requestScope
 sessionScope
 applicationScope
 Param
 paramValues
 header
 headerValues
 cookie
 Extracting property values
${beanName.propertyName}
or
${beanName[“propertyName”]}
 Arithmetic Operators
 Addition ${a+b}
 Subtraction ${a-b}
 Multiplication ${a*b}
 Division ${a/b}
 Modulo ${a%b}
 Relational Operators
 >,<,>=,<=,!=
 Greater than gt
 Less than lt
 Equals eq
 Greater than or equals ge
 Less than or equals
 Not equals
 Logical operators
 && (and)
 || (or)
 ! (not)
 Empty
 It will check whether object is empty
or not

 ${empty obj}
 Function implementation class
 Like custom tags functions are
implemented in java classes and
registered in TLD.
 The implementation function must be
public static method.
public class currency
{
public static double convert(double amount, String
fromcurrency, String tocurrency)
{
return amount * 1.44;
}
}
 Registering the function
 In order to make the function
available to a web application through
EL, we need to register it in Tag
Library Descriptor(TLD)
 Element used to register functions
 <function>
 <name>
 <function-class>
 <function-signature>

You might also like