Using JSP and JSTL, I am trying to import a Constant class into my template. At the top of my file, I have:
<%@ page import="app.util.Constant" %>
This throws no error, but I'm pretty sure the file is compiling correctly, because I get a compilation error if I try:
<%@ page import="app.util.DoesntExist" %>
Despite this working, I can't reference the Constant class or properties on it:
<c:if test="${Constant == null}">
<c:out value="foo"/>
</c:if>
<c:if test="${Constant.LOGIN_URL == null}">
<c:out value="bar"/>
</c:if>
Both foo and bar will be printed. How do I reference this class without resorting to <%= Constant.LOGIN_URL %>?
In my Constant class, I have:
public static final String LOGIN_URL = "login";
public static final String getLOGIN_URL() {
return LOGIN_URL;
}
Thanks in advance.