Home Jsp Simple-jsp-example Expression Language in JSP
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

Expression Language in JSP

Advertisement
EL means the expression language , it is a simple language for accessing data, it makes it possible to easily access application data stored in JavaBeans components.

Expression Language in JSP

        

EL means the expression language , it is a simple language for accessing data, it makes it possible to easily access application data stored in JavaBeans components. The jsp expression language allows a page author to access a bean using simple syntax such as $(name).  Before JSP 2.0, we could  use only  a scriptlet, JSP expression, or a custom tag to include server state in the jsp page output. Expression Language (EL) was first introduced in JSTL 1.0. EL makes it easier to integrate server side state with the presentation output. EL expressions are no longer limited to JSTL action attributes, but may be used in any standard or custom action attribute declared to accept a runtime expression. EL expressions can be used in static text. EL expressions can be used directly in template text outside of any actions.

EL expression is always written between the delimiters ${ and }. In the JSP page response, the result of expression evaluation replaces the expression and its delimiters in the template text. Within tags, expression can be used only in attribute values.

Code of the program is given below:

 

<html>
<head>
<title> Use of Expression Language in jsp</title></head>
<%pageContext.setAttribute("pageColor", "#FFFFDF");
%>
<body>
<table bgcolor=
"${pageScope.pageColor}" border
         ="1" cellpadding="0" cellspacing="0" 
align
="center" width="50%" height="50%">
<tr>
<td>
<b>Welcome to the Roseindia.net</b></td>
</tr>
<tr>
<td>
You appear to be using the following browser:<br>
${header["user-agent"]}
</td>
</tr>
</table>
</body>
</html>

Output of the Program:


 

Download this example.

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 9, 2008

Related Tutorials

Ask Questions?    Discuss: Expression Language in JSP  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
geetha
March 30, 2012
jsp

Expression Language is mainly used for reading purpose.Is it correct or not.
DMCA.com