This is because you are trying to compare a string with an int. In EL docs , section 1.8.2:
A {== ,! =, eq, ne} B
■ If A == B, apply the operator ■ If A is null or B is null, return false for == or eq, true for! = Or ne.
■ If A or B is BigDecimal, force both A and B to BigDecimal, and then:
■ If the operator is == or eq, return A.equals (B)
■ If the operator is! = Or ne, return! A.equals (B)
■ If A or B is a Float or Double, force A and B to Double, apply the statement
■ If A or B is BigInteger, force both A and B to BigInteger, and then:
■ If the operator is == or eq, return A.equals (B)
■ If the operator is! = Or ne, return! A.equals (B)
■ If A or B is a byte, short, character, integer, or long, forcing both A and B to Long, apply the operator
■ If A or B is a logical coercion of both A and B to Boolean, apply operato ■ If A or B is an enumeration, force A and B to enumerate, apply the operator ■ If A or B is a string that forces both A, so and B to String, compare lexically
■ Otherwise, if an error occurs when calling A.equals (B), the error ■ Otherwise, apply the operator to the result of A.equals (B)
The problem with your test is that you are trying to compare "$12,345" (String) with 0 (Integer). Since 0 is an integer, it ends up in bold If in its docs (above), where A or B is an integer. Both are trying to force a nest in Long, which Java will not convert the String value of "$12,345" to long. If you change your code to one of the following, you will see that it works:
String Comparison:
<c:set var="abc" value="$12,345" /> <c:choose> <c:when test="${abc ne '0'}"> <c:out value="PASS"></c:out> </c:when> <c:otherwise> <c:out value="FAIL"></c:out> </c:otherwise> </c:choose>
Integer comparison:
<c:set var="abc" value="12345" /> <c:choose> <c:when test="${abc ne 0}"> <c:out value="PASS"></c:out> </c:when> <c:otherwise> <c:out value="FAIL"></c:out> </c:otherwise> </c:choose>