jsp中的引号问题

错误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+"'";

就对了。

 

 

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

你可能感兴趣的:(jsp,servlet,String,user)