https://issues.apache.org/bugzilla/show_bug.cgi?id=57142
Bug ID: 57142
Summary: JSP 2.3 & EL 3.0 - %page import directive & EL
ImportHandler
Product: Tomcat 8
Version: trunk
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: Jasper
Assignee: [email protected]
Reporter: [email protected]
Depends on: 57141
The JSP 2.3 Spec mentions in "Table JSP.1-8" "Page Directive Attributes" that
"An import attribute describes the types that are available to
the scripting environment."
So if you had a JSP page with <%page import="org.test.*" the "org.test" package
reference does not make it into the EL context's ImportHandler for resolving
classes. This all does depend however, if as by the term "scripting
environment" the EL expressions are included.
If JSP 2.3 is to support resolving static fields etc(Bug #57141), like enums
then it makes sense that the import attribute would make available those
packages/classes to the EL processor. To make custom classes/enums work other
than the default java.lang.* for example ${MyCarEnum.PONTIAC == car.make}
The current workaround for importing packages into the EL processor in jsp
pages is to use something like the following in the contextInitialized method
inside a ServletContextListener...
JspFactory.getDefaultFactory().getJspApplicationContext(sce.getServletContext()).addELContextListener((ELContextEvent
e) -> {
e.getELContext().getImportHandler().importPackage("org.test.util");
e.getELContext().getImportHandler().importPackage("org.test.enums");
});
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]