[
https://issues.jboss.org/browse/WFLY-6939?page=com.atlassian.jira.plugin....
]
James Perkins commented on WFLY-6939:
-------------------------------------
An import is indeed needed. The spec states
{quote}
3. Except for classes with java.lang.* package names, a class has to be explicitly
imported before its static fields or methods can be referenced.
{quote}
The spec doesn't state anything about inner classes however. Looking at the
{{javax.el.ImportHandler}} however shows that using inner classes will not work.
{code:java}
private Class<?> getClassFor(String className) {
if (!notAClass.contains(className)) {
try {
return Class.forName(className, false,
Thread.currentThread().getContextClassLoader());
} catch (ClassNotFoundException ex) {
notAClass.add(className);
}
}
return null;
}
{code}
The class name would have to look something like {{org.jboss.example.Constants$Inner}}
which cannot be imported so the inner class object would fail to be instantiated by he
{{ImportHandler.getClassFor(String)}}.
In other words constants and enums needs to be imported and be top-level classes. This
should be working correctly as of WildFly 10.1.0.Final.
Usage of static fields from java.lang classes as EL expressions in
JSPs doesn't work
------------------------------------------------------------------------------------
Key: WFLY-6939
URL:
https://issues.jboss.org/browse/WFLY-6939
Project: WildFly
Issue Type: Bug
Components: Web (Undertow)
Affects Versions: 10.0.0.Final, 10.1.0.CR1
Reporter: jaikiran pai
Assignee: James Perkins
Fix For: 10.1.0.Final, 11.0.0.Alpha1
Java EE7 (which supports EL 3.0 spec) allows JSPs to use EL expressions like:
{code}
<html>
<body>
foo: --- ${Boolean.TRUE} ---<br>
bar: --- ${Integer.MAX_VALUE} ---<br>
</body>
</html>
{code}
However, the {code}${Boolean.TRUE}{code} and {code}${Integer.MAX_VALUE}{code} in the
above example aren't evaluated correctly and instead a blank string is rendered for
them.
More details in the linked forum thread
https://developer.jboss.org/thread/271825
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)