`
eagleking012
  • 浏览: 24422 次
  • 性别: Icon_minigender_1
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Attribute value is quoted with " which must be escaped when used within the value 问题解决

 
阅读更多

访问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 即可。

这样这个问题就算是解决了,如果大家发现有不正确的地方,请及时告诉我。

分享到:
评论

相关推荐

    Tomcat ssl报错Connector attribute SSLCertificateFile must be defined when using SSL with APR解决方法

    主要介绍了Tomcat ssl报错Connector attribute SSLCertificateFile must be defined when using SSL with APR解决方法,需要的朋友可以参考下

    SSD7 选择题。Multiple-Choice

    For two tables to be union compatible, the tables should be the same with respect to which of the following? (a) keys (b) cardinality (c) name (d) degree Correct answer is (d) Your ...

    2009 达内Unix学习笔记

    集合了 所有的 Unix命令大全 ...telnet 192.168.0.23 自己帐号 sd08077-you0 ftp工具 192.168.0.202 tools-toolss ... 各个 shell 可互相切换 ksh:$ sh:$ csh:guangzhou% bash:bash-3.00$ ... 命令和参数之间必需用空格隔...

    数位板压力测试

    When the user is viewing the device in its normal position, the coordinate origin will be at the lower left of the device. The coordinate system will be right-handed, that is, the positive x axis ...

    Multiple Attribute Decision Making with Incomplete Weight Information in Linguistic Setting

    Multiple Attribute Decision Making with Incomplete Weight Information in Linguistic Setting,卫贵武,,The aim of this paper is to investigate the multiple attribute decision making problems with ...

    微软内部资料-SQL性能优化2

    Each virtual memory address is tagged as to what access mode the processor must be running in. System space can only be accessed while in kernel mode, while user space is accessible in user mode. This...

    论文研究-Attribute Value Weighting in K-Modes Clustering.pdf

    Attribute Value Weighting in K-Modes Clustering,何增友,,In this paper, the traditional k-modes clustering algorithm is extended by weighting attribute value matches in dissimilarity computation....

    nRF51822 softdevice s110_nrf51_8.0.0

    The main features of this release are the ability to set the size of the GATT Server Attribute Table when initializing the BLE stack, the possibility for the application to be notified when the ...

    JSP Simple Examples

    This directive has only one attribute named as file, which is used to include a file in the jsp page at the translation time. &lt;jsp:include page = " "&gt;:- This is known as the include standard action....

    Google C++ Style Guide(Google C++编程规范)高清PDF

    Note that this guide is not a C++ tutorial: we assume that the reader is familiar with the language. Header Files In general, every .cc file should have an associated .h file. There are some common ...

    Atozed IntraWeb v15.1.5

    What’s New New property ServerController.... When set, IW will render class attribute for inner table using the property value Removed server signature in Http.sys More performance improvements

    servlet2.4doc

    Causes the next filter in the chain to be invoked, or if the calling filter is the last filter in the chain, causes the resource at the end of the chain to be invoked. doFilter(ServletRequest, ...

    Senfore_DragDrop_v4.1

    The define *must* be made in the project options. It is not sufficient to #define it in the source. If you manage to compile with C++ Builder (any version), I would very much like to know about it...

    Laravel开发-entity-attribute-value-model

    Laravel开发-entity-attribute-value-model Laravel的实体-属性-价值模型(EAV)

    VclZip pro v3.10.1

    - By defining ZLIB121, VCLZip will use the latest version of ZLib which is included with the registered version. Some optimization improvements which should show some improvement in zipping and ...

    Devart LinqConnect 3.1

    LinqConnect is a fast and easy-to-use ORM solution, developed ...The behaviour is changed: the TINYINT(1) data type is now used for the columns which correspond to the System.Boolean properties (MySQL)

    云模型在文本挖掘应用中的关键问题研究

    When cloud model is used to deal with the uncertainty relations between texts, itmusts be guaranteed that the values of every attribute are the same domain. That is to say, the different attribute ...

    Attribute-Based and Value-Based Clustering An Evaluation

    Attribute-Based and Value-Based Clustering An Evaluation

    雷达技术知识

    conditions the water surface plane is angled, which produces perpendicular angles of incidence allowing for greater chance of return (Maslov et al. 2000). Su et al. (2007) documented this concept by ...

Global site tag (gtag.js) - Google Analytics