4

I need to reference some constants held in a java interface, (they were put there by previous developers). But the problem of course is you get the error message:

javax.el.ELException: The class [com.foo] must be public, non-abstract and not an interface

What is the best way to go about accessing these constants? I have a workaround where I implement the interface in a class file and reference the constant from there in my jsp file. But it seems a bit of a roundabout way of doing it. Is there a better solution?

mohammedkhan
  • 953
  • 6
  • 14
  • 2
    Actually, the question is __not__ answered by the referred question. This question is specific for constants in interfaces. This cannot be solved with proposed solution of referred question. – Ward Nov 15 '19 at 08:19

1 Answers1

-2

As a workaround, you could bypass EL and use a JSP scriptlet instead:

<%
jspContext.setAttribute("CONSTANT_NAME", InterfaceName.CONSTANT_NAME);
%>
Ward
  • 2,799
  • 20
  • 26