jsp中的引号问题

来源:互联网 发布:11月阿里云推荐码 编辑:程序博客网 时间:2024/05/18 00:55

错误1: 

Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /Test3.jsp(13,34) Attribute value request.getParameter("test") is quoted with " which must be escaped when used within the value

 

源码:<jsp:param name="t" value="<%=request.getParameter("test")%>"/>

是因为""中不能再套用"";

改后:<jsp:param name="t" value='<%=request.getParameter("test")%>'/>就OK了。

 

 

错误2:

 

Can not issue data manipulation statements with executeQuery().

String isCorrect = "select * from tb_user where username='+ username+' and password='+password+'";

 

这样的单引号'+username+'系统不识别;所以改为:

String isCorrect = "select * from tb_user where username='"+ username+"' and password='"+password+"'";

就对了。

 

 

今天出了不少错误。我们在失败中成长。谢谢。失败是成功的调味剂。谢谢失败。