一、错误重现
开发中,有时候我们会遇到tomcat部署项目时,访问某个页面出现如下错误。
Attribute value view.getItems("SendAcctList") is quoted with " which must be escaped when used which must be esca
或者是Attribute value request.getParameter("name") is quoted with " which must be esca,今天部署一个比较老的项目时遇到了这个问题,我使用的是tomcat6.0,在网上查阅相关资料后,发现造成这个问题是jsp页面中包含有双引号包含双引号的地方,在tomcat升级到6.0之后,就会出现问题,之前的版本不会出现该问题。
二、错误发生位置及解决方案
(1)、发生问题位置 <t:radio name="FD_PayAcc"value="<%=view.getItems("SendAcctList")%>"defaultValue="<%=view.getValueNull("FD_PayAcc")%>"/>
(2)错误产生的原因:是因为tomcat版本升级后(6.0以后),对双引号的处理机制引起的,如果出现双引号包含双引号的情况,就可能会出现这个错误。
(3)、解决方案:
a、修改双引号包含双引号处,改为单引号包含双引号。
value="<%=view.getItems("SendAcctList")%>" 改为value='<%=view.getItems("SendAcctList")%>'
“Iffalsethe requirements for escaping quotes in JSP attributes will be relaxed so that an unescaped quote will not cause an error.
(1)、利用tomcat启动的执行脚本,在执行过程中调用setenv.sh,在其中设置环境变量,如:JAVA_OPTS=%JAVA_OPTS%: -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false。
(2)、在tomcat文件夹下找到conf/catalina.properties文件,在最后添加org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false ,重启tomcat就可以了,我使用的就是这种方法。