So I was recently upgrading an older application from Tomcat 6.0.16 to 6.0.20 and started to see a JasperException appear on several JSP pages I was testing. The exception stated something similar to the following:
[insert your var here] is quoted with " which must be escaped when used within the value..
So I looked at my code and saw the exception was complaining about a line of code similar to the following which worked for years with no problems:
<jsp:include page="<%= "/dir/" +someVariable + "/page.jsp" %>" />
Huh? I had hundreds of JSP pages with syntax similar to the above which had been working for years. I thought to myself what a nightmare this would be to go find and fix all of these! However, after some searching around online I discovered this bug issue which talks about how Tomcat was not totally JSP 2.0 compliant and was handling such variable declarations incorrectly. Anyways, they “fixed” this major issue (following my sarcasm here?), in Tomcat 6.0.17 and luckily they anticipated what a huge issue this might cause for folks out here, so they introduced a catalina.propeties property that you can specify in your TOMCAT_HOME/conf/catalina.properties.
Just add the following config to your catalina.properties file and restart Tomcat:
# TURN OF STRICT PARSING EXCEPTIONS
Hope that helps! Keep in mind that your code, if you don’t eventually “fix” it, may not work on other app servers.