Reference static fields in JSP without using scriptlets

el, java, jsp

Solution

Java Class

public class FunctionKeyConstants{
        public static final String NAME="Jigar";
        public String getNAME(){//NOTE THAT ITS NOT STATIC
             return NAME;
        }
}

JSP

<jsp:useBean id="cons" class="com.example.FunctionKeyConstants" scope="session"/>

then

${cons.NAME}

Problem

Possible Duplicate: Reference interface constant from EL So I have a JSP that currently has no scriptlets in it, i.e. there are no occurrences of "<%" (with the exception of "<%@") and instead multiple occurrences of "${javaVar}", which is EL. I now need to add something like this: ``` <security:hasPermissionTo functionKey="<%= FunctionKeyConstants.CREATE %>" ... ``` But I don't want to break the convention of this JSP. Can I do this using EL? Or any other suggestions?

Original source

Related problems