SESSION – 7
By→ Anuj Kumar Singh
Expression Language (EL) in JSP:
1. The Expression Language (EL) simplifies the accessibility of data
stored in the Java Bean component, and other objects like request,
session, application etc.
2. There are many implicit objects, operators and reserve words in EL.
3. It is the newly added feature in JSP technology version 2.0.
4. Syntax for Expression Language (EL)
${ expression }
Implicit Objects in Expression Language (EL)
There are many implicit objects in the Expression Language. They
are as follows:
Implicit Objects Usage
pageScope it maps the given attribute name with the value set in the page scope
requestScope maps the given attribute name with the value set in the request scope
sessionScope maps the given attribute name with the value set in the session scope
applicationScope maps given attribute name with the value set in the application scope
param it maps the request parameter to the single value
paramValues it maps the request parameter to an array of values
header it maps the request header name to the single value
headerValues it maps the request header name to an array of values
cookie it maps the given cookie name to the cookie value
initParam it maps the initialization parameter
pageContext it provides access to many objects request, session etc.
Example:
a. index.html
b. newjsp.jsp
Output
Implicit Objects Usage
pageScope maps the given attribute name with the value set in the page scope
requestScope maps given attribute name with the value set in the request scope
sessionScope maps given attribute name with the value set in the session scope
applicationScope maps given attribute name with the value set in application scope
param it maps the request parameter to the single value
paramValues it maps the request parameter to an array of values
header it maps the request header name to the single value
headerValues it maps the request header name to an array of values
cookie it maps the given cookie name to the cookie value
initParam it maps the initialization parameter
pageContext it provides access to many objects request, session etc.
Example:
1. EL in Session
Output
a. newjsp.jsp
b. process.jsp
2. EL in Cookies
a. newjsp.jsp
b. process.jsp
Output
Precedence of Operators in EL
[] .
()
-(unary) not ! empty
* / div % mod
+ - (binary)
< <= > >= lt le gt ge
== != eq ne
&& and
|| or
?:
Reserve words in EL
lt le gt ge
eq ne true false
and or not instanceof
div mod empty null
Jsp   session 7

Jsp session 7

  • 1.
    SESSION – 7 By→Anuj Kumar Singh
  • 2.
    Expression Language (EL)in JSP: 1. The Expression Language (EL) simplifies the accessibility of data stored in the Java Bean component, and other objects like request, session, application etc. 2. There are many implicit objects, operators and reserve words in EL. 3. It is the newly added feature in JSP technology version 2.0. 4. Syntax for Expression Language (EL) ${ expression } Implicit Objects in Expression Language (EL) There are many implicit objects in the Expression Language. They are as follows:
  • 3.
    Implicit Objects Usage pageScopeit maps the given attribute name with the value set in the page scope requestScope maps the given attribute name with the value set in the request scope sessionScope maps the given attribute name with the value set in the session scope applicationScope maps given attribute name with the value set in the application scope param it maps the request parameter to the single value paramValues it maps the request parameter to an array of values header it maps the request header name to the single value headerValues it maps the request header name to an array of values cookie it maps the given cookie name to the cookie value initParam it maps the initialization parameter pageContext it provides access to many objects request, session etc.
  • 4.
  • 5.
    Implicit Objects Usage pageScopemaps the given attribute name with the value set in the page scope requestScope maps given attribute name with the value set in the request scope sessionScope maps given attribute name with the value set in the session scope applicationScope maps given attribute name with the value set in application scope param it maps the request parameter to the single value paramValues it maps the request parameter to an array of values header it maps the request header name to the single value headerValues it maps the request header name to an array of values cookie it maps the given cookie name to the cookie value initParam it maps the initialization parameter pageContext it provides access to many objects request, session etc.
  • 6.
    Example: 1. EL inSession Output a. newjsp.jsp b. process.jsp
  • 7.
    2. EL inCookies a. newjsp.jsp b. process.jsp Output
  • 8.
    Precedence of Operatorsin EL [] . () -(unary) not ! empty * / div % mod + - (binary) < <= > >= lt le gt ge == != eq ne && and || or ?:
  • 9.
    Reserve words inEL lt le gt ge eq ne true false and or not instanceof div mod empty null