[jboss-jira] [JBoss JIRA] (WFLY-12650) EL does not handle identifiers as JavaBeans
Ricardo Martin Camarero (Jira)
issues at jboss.org
Tue Nov 12 07:28:00 EST 2019
[ https://issues.jboss.org/browse/WFLY-12650?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13811261#comment-13811261 ]
Ricardo Martin Camarero commented on WFLY-12650:
------------------------------------------------
Finally it was decided to not delete the ImportedClassELResolver but adding a system property that allows disable it:
{noformat}
-Dorg.wildfly.extension.undertow.deployment.disableImportedClassELResolver=true
{noformat}
So the issue will be in wildfly but you can add that property to completely follow the spec. Note that this issue is a corner case when a variable matches a class name (you can always change the property name, using "testMBean" in the example JSP of teh description). The reason for this is to avoid a [performance penalty problem in the ScopedAttributeELResolver implementation|https://github.com/eclipse-ee4j/jsp-api/issues/57] that was also fixed previously in our own ImportedClassELResolver.
> EL does not handle identifiers as JavaBeans
> -------------------------------------------
>
> Key: WFLY-12650
> URL: https://issues.jboss.org/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
> 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.pdf], 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}
--
This message was sent by Atlassian Jira
(v7.13.8#713008)
More information about the jboss-jira
mailing list