Attribute value is quoted with " which must be escaped when used within the value 问题解决
来源:互联网 发布:mac tomcat 编辑:程序博客网 时间:2024/05/20 04:26
访问JSP时,报错:Attribute value is quoted with " which must be escaped when used within the value 。相信很多人都遇到过,以下结合本人查资料与亲自实践得到的结论。
有不对的地方还请指教。
1):错误常发生的位置 value="<%=""+request.getAttribute("name")%>"
2):错误产生的原因,是因为tomcat版本升级后(6.0以后),对双引号的处理机制引起的,如果出现双引号包含双引号的情况,就可能会出现这个错误。
3):解决办法有好多种,大多数网上的意见是改为value=‘<%=""+request.getAttribute("name")%>’ 这样确实可以解决这个报错,可能无法完全解决问题,比如项目中有很多地方以前都用的是双引号,修改起来会非常麻烦,还容易出错。
查看tomact文档有一段话这样描述的“If false
the requirements for escaping quotes in JSP attributes will be relaxed so that an unescaped quote will not cause an error.
If not specified, the specification compliant default of true
will be used.” 这个描述针对的是tomact的org.apache.jasper.compiler. Parser.STRICT_QUOTE_ESCAPING
属性。
如此一来,我们知道只要在tomcat启动时将这个属性设为false就可以解决这个问题。
那么怎么将这个属性设置到tomcat的system属性中呢,有至少两个办法:
一种是利用tomcat启动的执行脚本,在执行过程中调用setenv.sh,在其中设置环境变量,如:JAVA_OPTS=%JAVA_OPTS%: -Dorg.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false
另一种是找到conf/catalina.properties文件,在最后添加org.apache.jasper.compiler.Parser.STRICT_QUOTE_ESCAPING=false 即可。
这样这个问题就算是解决了,如果大家发现有不正确的地方,请及时告诉我。
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- 问题解决: Attribute value request.getParameter("id") is quoted with " which must be escaped when used within the value
- Attribute value "xx" is quoted with " which must be escaped when used within the
- Attribute value request.getParameter("digyso") is quoted with " which must be escaped when used within the value
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正1
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正2
- Attribute value ("XXX") is quoted with " which must be escaped when used within the value 异常的修正1
- ttribute value is quoted with " which must be escaped when used within the value
- 错误:is quoted with " which must be escaped when used within the value
- is quoted with " which must be escaped when used within the value
- JasperException: is quoted with " which must be escaped when used within the value
- 错误:is quoted with " which must be escaped when used within the value .
- 错误:is quoted with " which must be escaped when used within the value (转载)
- 64位操作系统的IIS运行32位站点
- Twitter Storm如何保证消息不丢失
- 聚类
- 数据为空。不能对空值调用此方法或属性的解决办法
- Coding更改程序的变式(report variant change)
- Attribute value is quoted with " which must be escaped when used within the value 问题解决
- activity to View
- gif文件导出png
- android中一些基本知识的理解
- java final关键字
- ubuntu 10.10及以后版本修改为默认文本界面
- 关于百度蜘蛛 200 0 64 状态码的分析与解决
- java.lang.OutOfMemoryError: Java heap space Maven编译时报堆空间不足解决方案
- struts2生成excel文件和下载