Jsp问题小结

来源:互联网 发布:炫踪网络 过会 编辑:程序博客网 时间:2024/06/05 21:09

今天,将项目放到服务器上后,调试项目时,发现了一个问题:Attribute value request.getParameter("searchtype") is quoted with " which must be escaped when used within the value。源代码如下:

      input type="hidden" name="searchtype" value="<%=request.getParameter("searchtype")%>" />

     说明:改jsp页面在本地测试一切正常,无奈这下G了一下原因,说是需要在"前加个转义符号/,试了一下果然管用。

     修改后的代码:<input type="hidden" name="searchtype" value="<%=request.getParameter(/"searchtype/")%>" />

     总结:Master Cui告诉我说,有可能是tomcat的版本不同导致的。jsp在编译jsp页面时,将<%=request.getParameter("searchtype")%>作为变量进行处理。因此,遇到里面的"会报错。微笑今天又学会了一招哟。嘿嘿……

原创粉丝点击