Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<c:if> not working for comparing characters [duplicate]

Tags:

char

jsp

jstl

el

<c:if> is not working for comparing characters.The code is inside a table.Here is the code

<c:if test="${record.type eq 'U' }">Planned</c:if>

When I use this code inside the table,the table content is not displayed.Please help!

like image 732
psms Avatar asked Aug 26 '14 04:08

psms


1 Answers

Issue is EL supports both double and single quoted Strings. So 'U' is taken as String, not char. To resolve the issue, you can use charAt(0) method on that String:

<c:if test="${record.type eq 'U'.charAt(0) }">Planned</c:if>
like image 104
Rohit Jain Avatar answered Dec 09 '22 17:12

Rohit Jain