当前位置: 代码迷 >> Web前端 >> 异常:is quoted with " which must be escaped when used within the value
  详细解决方案

异常:is quoted with " which must be escaped when used within the value

热度:375   发布时间:2012-09-15 19:09:29.0
错误:is quoted with " which must be escaped when used within the value

Attribute value request.getAttribute("pageNo") is quoted with " which must be escaped when used within the value

今天突然遇到这个奇怪的问题:google了一下,发现如下原因:

转载自:csdn博客

?

遇到这样的问题在网上找了解决方案现总结2点:

解决以上问题有两种解决方案:

?

方案一

?

???<jsp:include page="split_page.jsp">
????<jsp:param name="jspUrl" value="<%=jspUrl%>" />
????<jsp:param name="lineSize"
?????value="<%=request.getAttribute("lineSize")%>" />
????<jsp:param name="searchFlag" value="T" />
???</jsp:include>


这里,在 value 中只是使用了 URL 而已。

然后报错:

Attribute value request.getAttribute("lineSize") is quoted with " which must be escaped when used within the value


啊,无语,在另一个页面中这么写就没错啊?

Google。

发现说是什么 apache 升级到 6.0 后出现的 bug。

详情见:

[#MMB-1706] quoted must be escaped - MMBase

然后跟踪链接,这里说的很详细了:

Possible user code changes required when we upgrade to Tomcat 6.0.18

按照上面的说法,这么改写:?

?<jsp:include page="split_page.jsp">
????<jsp:param name="jspUrl" value="<%=jspUrl%>" />
????<jsp:param name="lineSize"
?????value='<%=request.getAttribute("lineSize")%>' />
????<jsp:param name="searchFlag" value="T" />
?</jsp:include>

其实只是把 value="" 改成 value=''。

?

方案二

?

把代码改成

???<jsp:include page="split_page.jsp">
????<jsp:param name="jspUrl" value="<%=jspUrl%>" />
????<jsp:param name="lineSize"
?????value="<%=request.getAttribute(/"lineSiz/")%>" />
????<jsp:param name="searchFlag" value="T" />
???</jsp:include>

?

虽然在编辑器中会显示有错? 但是运行起来是没有问题,tomcat版本的问题

  相关解决方案