Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between eq and == in JSP

Tags:

jsp

jstl

What is the difference, if any, between the keyword 'eq' and the operator '==' in JSP Expression Language?

In code, what is the difference between:

<c:if test="${var1 eq var2}">some code</c:if> 

and

<c:if test="${var1 == var2}">some code</c:if> 
like image 518
ryanprayogo Avatar asked Jan 18 '10 17:01

ryanprayogo


People also ask

What is the difference between Scriptlet <%?

The scriptlet is everything inside the <% %> tags. Between these the user can add any valid Scriptlet i.e. any valid Java Code. In AppleScript, a scriptlet is a small script. In Windows, a scriptlet is COM component including a HTML code and a script which may be written in a variety of scripting languages.

What does ${} mean in JSP?

You can now include a JSP EL expression in the body of a <jsp:text> tag (or any other tag) with the same ${} syntax you use for attributes.

Is El ignored in JSP?

The default mode for JSP pages delivered using a descriptor from Servlet 2.3 or before is to ignore EL expressions; this provides backward compatibility.


1 Answers

eq exists (as well as ne, lt, etc) so you can avoid using XML entity references (< is an XML character and would need to be escaped as &lt;, for example), but they do the same thing.

See Comparison operators in JSP for more info.

like image 100
danben Avatar answered Sep 22 '22 12:09

danben