Closed ops4j-issues closed 9 years ago
Freeman Fang commented
I attached a revised jsp-filter example to demonstrate this issue, the change is like
--- a/samples/jsp-filter/src/main/webapp/WEB-INF/web.xml
+++ b/samples/jsp-filter/src/main/webapp/WEB-INF/web.xml
@@ -16,4 +16,12 @@
<url-pattern>includes/*</url-pattern>
<dispatcher>INCLUDE</dispatcher>
</filter-mapping>
-</web-app>
\ No newline at end of file
+
+ <jsp-config>
+ <jsp-property-group>
+ <url-pattern>*.jsp</url-pattern>
+ <include-prelude>/WEB-INF/jspf/headertags.jspf</include-prelude>
+ </jsp-property-group>
+ </jsp-config>
+
+</web-app>
diff --git a/samples/jsp-filter/src/main/webapp/index.jsp b/samples/jsp-filter/src/main/webapp/index.jsp
index 63ff034..c9d530c 100644
--- a/samples/jsp-filter/src/main/webapp/index.jsp
+++ b/samples/jsp-filter/src/main/webapp/index.jsp
@@ -18,6 +18,11 @@ String message = "Hello, World, from JSP";
<jsp:include page="includes/test.jsp" />
</font></h3>
+<c:set var="hello" value="Hello World FangYue"/>
+ <h1>
+ <c:out value="${hello}"/>
+ </h1>
+
</BODY>
-</HTML>
\ No newline at end of file
+</HTML>
and the new added headertags.jspf is like
<%@ taglib prefix="form" tagdir="/WEB-INF/tags/form" %>
<%@ taglib prefix="jms" tagdir="/WEB-INF/tags/jms" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
Freeman Fang commented
The debug told me that the ServletConfig passed into the org.apache.jasper.servlet.JspServletWrapper maintained by the pax-web-jsp module carry no info about the jsp-config tag in web.xml, the
config.getServletContext().getJspConfigDescriptor() //just return null here
just return null, so this can explain why the jasper jsp compiler know nothing about the jsp-config tag in web.xml.
Still don't know why. Seems the jetty servlet container didn't parse the web.xml correctly before pass the ServletConfig to org.apache.jasper.servlet.JspServletWrapper .
Achim Nierbeck commented
Might be that the Pax-Web-webextender which takes care of the web.xml parsing missed that ...
Achim Nierbeck commented
This part is definitely missing ...
for master branch I'll try to migrate the way the web.xml is parsed in the undertow branch into the master. For 4.x and earlier I'll add those functionalities in a different way.
Freeman Fang commented
Hi Achim,
For the 4.x I finally figured out that it's the org.apache.jasper.compiler.JspConfig class change cause this problem.
In previous version(like the pax-web 3.x) the JspConfig1 will parse the web.xml to build the jspProperties, but for the version2 used in the pax-web 4.x, it won't, it just try to get it from the ServletContext. Not sure what's your solutions, I'm just going to revise the tomcat-jasper/8.0.14/org/apache/jasper/compiler/JspConfig.java to add the code to parse the web.xml(like what 1 do) as a fallback if can't get it from the ServletContext.
This is definitely your area so I will leave this for you, just let you know my progress here(which took me several whole days to reach :wink:)
1http://grepcode.com/file/repo1.maven.org/maven2/org.mortbay.jetty/jsp-2.1-glassfish/9.1.1.B60.25.p1/org/apache/jasper/compiler/JspConfig.java
2http://grepcode.com/file/repo1.maven.org/maven2/org.apache.tomcat/tomcat-jasper/8.0.14/org/apache/jasper/compiler/JspConfig.java
Thanks
Freeman
Achim Nierbeck commented
Interesting that those did re-read the web.xml again :smile:
Actually I'm working on adding those sections to the parsing of the web-extender so those can be added to the HttpContext which should end in the servletcontext as well. Thanks for spotting.
In the meantime if you have a fallback at hand this is for sure a quick solution which might be the only way to do so right now. We'll see :grinning:
Freeman Fang commented
Thanks Achim, will push my changes soon.
Freeman Fang commented
commit fix
https://github.com/ops4j/org.ops4j.pax.web/commit/033bb0dae8d027acf5dd305fe2992ae095b670d1 for master
https://github.com/ops4j/org.ops4j.pax.web/commit/0b84eae9f311b950534120b5215efa987cb21b4a for pax-web-4.1.x branch
Achim Nierbeck commented
The current fix is sufficient for 4.1.x
Achim Nierbeck commented
even though this seems to do the job with Jetty, I need to investigate why it fails for Tomcat as container. See PAXWEB-878
Freeman Fang created PAXWEB-842
If I have the jsp tag headers in an seperate file and I wanna all jsp files in my war to pick up the tag headers automatically, so I use something like
but this doesn't work in 4.1.x(it works in previous version), so that my script in the page like c:out not recognized.
Affects: 4.1.2 Fixed in: 4.1.3 Attachments:
Votes: 0, Watches: 2
Referenced issues
is related from:
1134 - The jsp-config/jsp-property-group/include-prelude doesn't work, web.xml isn't parsed correctly [PAXWEB-847]