<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!
<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!
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>
This works for me:
`<c:if test="${'U'.toString() eq 'U'}">demo</c:if>`
It works for me since instead of first 'U', I was getting the list of Characters. So the type should be converted to String first.)
check the value of ${record.type}
print it on jsp
becuse
<c:if test="${'U' eq 'U'}">demo</c:if>
it works for me in jsp
or if you have some version conflict then
try below one it may help
<c:if test = "${record.type == 'U'}">demo</c:if>
but make sure the value of ${record.type}