]
Ilia Vassilev updated WFLY-12650:
---------------------------------
Labels: downstream_dependency (was: )
EL does not handle identifiers as JavaBeans
-------------------------------------------
Key: WFLY-12650
URL:
https://issues.redhat.com/browse/WFLY-12650
Project: WildFly
Issue Type: Bug
Components: EE, Web (Undertow)
Affects Versions: 18.0.0.Final
Reporter: Ricardo Martin Camarero
Assignee: Ricardo Martin Camarero
Priority: Major
Labels: downstream_dependency
Fix For: 19.0.0.Beta1
Attachments: ELTest.war
Even if defined JavaBeans using <jsp:useBean> in jsp, the EL expression is handled
as java Class if that class is already imported in jsp.
{code:title=EX)test1.jsp|borderStyle=solid}
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@page import="test.TestMBean"%>
<html>
<head>
<title>Test1</title>
</head>
<body>
<jsp:useBean id="TestMBean" class="test.TestMBean"/>
TestMBean.test : ${TestMBean.test} <br/>
</body>
</html>
{code}
Therefore, the following exceptions may occur:
{noformat}
Caused by: javax.el.PropertyNotFoundException: Either 'test' is not a public
static field of the class 'test.TestMBean' or field is inacessable
at javax.el.StaticFieldELResolver.getValue(StaticFieldELResolver.java:107)
at org.apache.jasper.el.JasperELResolver.getValue(JasperELResolver.java:110)
at com.sun.el.parser.AstValue.getValue(AstValue.java:139)
at com.sun.el.parser.AstValue.getValue(AstValue.java:203)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:917)
at org.apache.jsp.test1_jsp._jspService(test1_jsp.java:107)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:433)
... 46 more
{noformat}
According [EL
spec|https://download.oracle.com/otn-pub/jcp/el-3_0-fr-eval-spec/EL3.0.FR...],
Evaluating of the imported static field should be the last.
{quote}
1.5.1 Evaluating Identifiers
The steps are used for evaluating an identifier.
■ If the identifier is a lambda argument passed to a lambda expression invocation, its
value is returned.
■ Else if the identifier is a variable, the associated expression is evaluated and
returned.
■ Else if the identifier is resolved by the ELResolvers, the value returned from the
ELResolvers is returned.
■ Else if the identifier is an imported static field, its value is returned.
■ Else return not resolved.
One implication of the explicit search order of the identifiers is that an identifier
hides other identifiers (of the same name) that come after it in the list.
{quote}