difference between eq and == in JSP
Asked Answered
B

1

35

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>
Blaisdell answered 18/1, 2010 at 17:2 Comment(0)
P
42

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.

Polymyxin answered 18/1, 2010 at 17:6 Comment(1)
Entirely correct, they're exactly the same. The characterbased operators are only XML-safe.Illyria

© 2022 - 2024 — McMap. All rights reserved.