Tomcat升级到6.0遇到的双引号改单引号问题

JSP页面中出现赋值,字符串联接


<display:column property="<%="key"+(i+1) %>" title="<%=reportHead[i]%>" format="{0,number, ###,###.##}" class="its" sortable="true" style="width:75;text-align:right;" total="true" defaultorder="descending"/>


 


就会报解析异常


javax.servlet.ServletException: /aa.jsp(37,32) Attribute value "key" + (i + 1) is quoted with " which must be escaped when used within the value org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286) org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) javax.servlet.http.HttpServlet.service(HttpServlet.java:647) javax.servlet.http.HttpServlet.service(HttpServlet.java:729) com.pip.count.filter.AuthenticateFilter.doFilter(AuthenticateFilter.java:142) com.pip.count.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:65)
 


可以通过设置System Properties来改变tomcat的默认行为:     
   
   
org.apache.jasper.compiler. Parser.STRICT_QUOTE_ESCAPING     
   
If false the requirements for escpaing quotes in JSP attributes will be relaxed so that a missing required quote will not cause an error. If not specified, the specification compliant default of true will be used.  
打开网址:http://tomcat.apache.org/tomcat-5.5-doc/config/systemprops.html


可以看到,我们可以修改这个配置,即可解决这个问题


所以解决这个问题的最终办法是:


修改Tomcat目录:D:\Java\tomcat-6.0.20\conf下面的catalina.properties文件,在最后面加入:


org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false


即可。


##########################
修改Tomcat目录:D:\Java\tomcat-6.0.20\conf下面的catalina.properties文件,在最后面加入:


org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false




 


源自


http://quicker.javaeye.com/blog/739779

你可能感兴趣的:(Tomcat升级到6.0遇到的双引号改单引号问题)