char comparison in EL expression

char, comparison, el, java, jsp

Solution

EL seems to have trouble with char. Here is the only way I could make it work.

<c:if test="${somestring.charAt(0)  == '1'.charAt(0)}" >
     tadaaaam
</c:if>

Problem

I want to do something like this: ``` <c:if test="${somestring.charAt(0)=='1'}"> tadaaaam </c:if> ``` when somestring is "11011" but it doesn't work. I can print it with ``` ${somestring.charAt(0)} ``` and it is '1' but comparison above fails. The following comparison: ``` if(somestring.charAt(0)=='1') ``` worx (condition is true) in pure Java. Any ideas?

Original source

Related problems