https://bz.apache.org/bugzilla/show_bug.cgi?id=66441
Bug ID: 66441 Summary: Static field import failed on Expression Language lookup Product: Tomcat 10 Version: 10.1.5 Hardware: PC OS: Mac OS X 10.1 Status: NEW Severity: normal Priority: P2 Component: Jasper Assignee: dev@tomcat.apache.org Reporter: isaacriv...@gmail.com Target Milestone: ------ Hello! Working with JSP pages and static imports using Tomcat's EL Jasper implementation, I found that importing a static field with EL lookup did not resolve to the correct value. Tried the following jsp <%@ page import = "static myapp.Example.STATIC_VAR, static myapp.Example.STATIC_METHOD" %> <html> <head> <title>Import Static</title> </head> <body> EL expressions: <br/> ${STATIC_VAR} ${STATIC_METHOD()} <br/> <br/> JSP expressions: <br/> <%=STATIC_VAR%> <%=STATIC_METHOD()%> </body> </html> The JSP expressions resolve as expected but of the EL expressions, only STATIC_METHOD() works. After some investigation we narrowed down that the problem may potentially be here https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/el/parser/AstIdentifier.java#L101-L103 where the variable is resolved by the NotFoundELResolver and the import block to resolveStatic is not reached here https://github.com/apache/tomcat/blob/10.1.x/java/org/apache/el/parser/AstIdentifier.java#L105-L110. We are using the API from JakartaEE and not the API from Tomcat for Pages. If we change to Tomcat's API then it does behave as expected. This is because the ImportELResolver from Tomcat does a static lookup in its resolver here https://github.com/apache/tomcat/blob/10.1.x/java/jakarta/servlet/jsp/el/ImportELResolver.java#L85-L92 whereas the Jakarta API does not cover it here https://github.com/jakartaee/pages/blob/master/api/src/main/java/jakarta/servlet/jsp/el/ImportELResolver.java#L63-L71. Not sure if this should be fixed in the implementation of Tomcat or if it's something that should be address in the Jakarta Pages API. Any help is appreciated, thanks in advance!! -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org