Home Jsp Simple-jsp-example EL Basic Comparisons



EL Basic Comparisons
Posted on: February 9, 2008 at 12:00 AM
EL means the expression language , it makes it possible to easily access application data stored in JavaBeans components.

EL Basic Comparisons

        

EL means the expression language , 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 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.

The Expression Language has the following Basic Comparisons:

< >   <=   >=   lt   gt le  ge

= =  !=   eq  ne

&&   and

||  or

The code of the program is given below:

 

<html>
<head>
<title>Basic Comparisons</title>
</head>
<body>
<h1>Basic Comparisons</h1>
<hr>
In EL the following comparison operators are supported:
<ul>
<li>Less-than (&lt; or lt)</li>
<li>Greater-than (&gt; or gt)</li>
<li>Less-than-or-equal (&lt;= or le)</li>
<li>Greater-than-or-equal (&gt;= or ge)</li>
<li>Equal (== or eq)</li>
<li>Not Equal (!= or ne)</li>
</ul>
<blockquote>
<u><b>Numeric</b></u>
<code>
<table border="1">
<thead>
<td><b>EL Expression</b></td>
<td><b>Result</b></td>
</thead>
<tr>
<td>\${5 &lt; 7}</td>
<td>${5 < 7}</td>
</tr>
<tr>
<td>\${5 lt 7}</td>
<td>${5 lt 7}</td>
</tr>
<tr>
<td>\${4 &gt; (6/2)}</td>
<td>${4 > (6/2)}</td>
</tr>
<tr>
<td>\${4 &gt; (6/2)}</td>
<td>${4 > (6/2)}</td>
</tr>
<tr>
<td>\${6.0 &gt;= 3}</td>
<td>${6.0 >= 3}</td>
</tr>
<tr>
<td>\${6.0 ge 3}</td>
<td>${6.0 ge 3}</td>
</tr>
<tr>
<td>\${4 &lt;= 3}</td>
<td>${4 <= 3}</td>
</tr>
<tr>
<td>\${4 le 3}</td>
<td>${4 le 3}</td>
</tr>
<tr>
<td>\${2.0 == 2}</td>
<td>${2.0 == 2}</td>
</tr>
<tr>
<td>\${2.0 eq 2}</td>
<td>${2.0 eq 2}</td>
</tr>
<tr>
<td>\${(10*10) != 100}</td>
<td>${(10*10) != 100}</td>
</tr>
<tr>
<td>\${(10*10) ne 100}</td>
<td>${(10*10) ne 100}</td>
</tr>
</table>
</code>
</blockquote>
</body>
</html>

The output of the program is given below:

Download this example:

Related Tags for EL Basic Comparisons:
cjspsyntaxserverscriptlanguageioincludecustomoutputippageexpressiontagstatenameusingsimplejsfortoexpress2.0ldlanssiwsbeaneaxauthputuseulimceinasstamntoutbealetjclestaxscriptletallagemessuspessbeforeatauthorincllmplpresspreeastatccrvsimxpscrssriripthstaccesspleplpronlyonomonl


More Tutorials from this section

Ask Questions?    Discuss: EL Basic Comparisons  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.