I'm using Weblogic 12c, the webapp is of servlet version 3.1.
I struggle how to evaluate static fields by EL.
Java Class:
package com.example;
public class MyClass {
public static final String MY_CONSTANT = "ABC";
}
JSP:
<%@ page import="com.example.MyClass" %>
<h1>Servlet Version: <%=pageContext.getServletContext().getEffectiveMajorVersion()%>.<%=pageContext.getServletContext().getEffectiveMinorVersion()%></h1>
<h1>Scriptlet: <%=MyClass.MY_CONSTANT%></h1>
<h1>EL Expression: ${MyClass.MY_CONSTANT}</h1>
<h1>Boolean.TRUE: ${Boolean.TRUE}</h1>
Result:
Servlet Version: 3.1
Scriptlet: ABC
EL Expression:
Boolean.TRUE: true
The expression ${MyClass.MY_CONSTANT} is evaluated to empty.
According to this answer, static fields can be evaluated by EL 3.0. And EL 3.0 is supported by servlet version 3.1 AFAIK.
So why can't I access the static field using EL?