Mixing expressions and expression language (<%= %> inside of c:if)
Posted
by
Jack
on Stack Overflow
See other posts from Stack Overflow
or by Jack
Published on 2011-01-13T10:55:36Z
Indexed on
2011/01/15
9:53 UTC
Read the original article
Hit count: 198
I need to access some constants in my jsp, and sadly the EL does not offer any functionality for it. There are some options like the unstandard tag library, but I'd like to keep it a bit more standard.
I tried:
<%@ page import = "com.jackdane.Constants"%>
<c:if test="${object.display == '<%=com.jackdane.Constants.YES %>}'">
//some display logic
</c:if>
But that doesn't appear to do the trick. It's been a while since I've used an expression so I might have made an error. Any input is appreciated.
Edit:
To clarify, the constants class is not in my control. It's inside a jar file that I recieved.
It contains no getters/setters.
Just private static final Strings
.
© Stack Overflow or respective owner