Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-12650

EL does not handle identifiers as JavaBeans

    XMLWordPrintable

Details

    • Hide

      1. Deploy ELTest.war on EAP 7.2.x server.
      2. Execute $ curl localhost:8080/ELTest/test1.jsp.
      3. You can confirm javax.el.PropertyNotFoundException.

      4. Reboot EAP 7.2.x server
      5. Execute $ curl localhost:8080/ELTest/test2.jsp.
      6. Since the test2.jsp does not inport bean class in jsp, you can get a proper response below.

      $ curl localhost:8080/ELTest/test2.jsp

      <html>
      <head>
      <title>Test2</title>
      </head>
      <body>

      TestMBean.test : default test value <br/>
      </body>
      </html>

      test2.jsp
      <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
      
      
      <html>
      <head>
      <title>Test2</title>
      </head>
      <body>
      <jsp:useBean id="TestMBean" class="test.TestMBean"/>
      TestMBean.test : ${TestMBean.test} <br/>
      </body>
      </html>
      
      Show
      1. Deploy ELTest.war on EAP 7.2.x server. 2. Execute $ curl localhost:8080/ELTest/test1.jsp . 3. You can confirm javax.el.PropertyNotFoundException . 4. Reboot EAP 7.2.x server 5. Execute $ curl localhost:8080/ELTest/test2.jsp . 6. Since the test2.jsp does not inport bean class in jsp, you can get a proper response below. $ curl localhost:8080/ELTest/test2.jsp <html> <head> <title>Test2</title> </head> <body> TestMBean.test : default test value <br/> </body> </html> test2.jsp <%@ page language= "java" contentType= "text/html; charset=UTF-8" pageEncoding= "UTF-8" %> <html> <head> <title>Test2</title> </head> <body> <jsp:useBean id= "TestMBean" class= "test.TestMBean" /> TestMBean.test : ${TestMBean.test} <br/> </body> </html>

    Description

      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.

      EX)test1.jsp
      <%@ 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>
      

      Therefore, the following exceptions may occur:

      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
      

      According EL spec, Evaluating of the imported static field should be the last.

      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.

      Attachments

        Issue Links

          Activity

            People

              rhn-support-rmartinc Ricardo Martin Camarero
              rhn-support-rmartinc Ricardo Martin Camarero
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: