錯誤:is quoted with " which must be escaped when used within the value .

來源:互聯網
上載者:User

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

今天突然遇到這個奇怪的問題:google了一下,發現如下原因:

 

遇到這樣的問題在網上找瞭解決方案現總結2點:

解決以上問題有兩種解決方案:

 

方案一

 

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


這裡,在 value 中只是使用了 URL 而已。

然後報錯:

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


啊,無語,在另一個頁面中這麼寫就沒錯啊。

Google。

發現說是什麼 apache 升級到 7.0 後出現的 bug。

詳情見:

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

然後跟蹤連結,這裡說的很詳細了:

Possible user code changes required when we upgrade to Tomcat 7.0.18

按照上面的說法,這麼改寫: 

 <jsp:include page="split_page.jsp">
    <jsp:param name="jspUrl" value="<%=jspUrl%>" />
    <jsp:param name="xx_khid"
     value='<%=request.getAttribute("xx_khid")%>' />
    <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="xx_khid"
     value="<%=request.getAttribute(/"xx_khid/")%>" />
    <jsp:param name="searchFlag" value="T" />
   </jsp:include>

 

雖然在編輯器中會顯示有錯  但是運行起來是沒有問題,tomcat版本的問題。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.