Mike
Mike

Reputation: 302

JSP JSTL <c:if="${1 == 2}"> returning true

I've been having issues where JSTL c:if does not seem to be working correctly.. so I tested it with the following statement...

<c:if="${1 == 2}">
   1 is equal to 2
</c:if>

And it is outputting "1 is equal to 2"...

Is there something I'm missing here?

EDIT: found the issue and it was me being silly.. the problem was I'd forgot to include the jstl core tag library in the page

Upvotes: 1

Views: 1547

Answers (1)

BalusC
BalusC

Reputation: 1109635

The EL expression with the condition has to be a value of the test attribute.

<c:if test="${1 == 2}">
   1 is equal to 2
</c:if>

See also:

Upvotes: 5

Related Questions