+ -
当前位置:首页 → 问答吧 → jsp/tomcat

jsp/tomcat

时间:2011-12-08

来源:互联网

我用tomcat做网络应用服务器,MySql做数据库服务器,当执行:
http://192.168.204.158:8080/mygold/show.jsp?id=1 and (select count(*) from news)>=0
这句话时,这相当于向数据库发送SQL语句:
select * from login where id=1 and (select count(*) from news) >=0,
其中的login是数据库中存在的表,news是不存在的,执行后页面返回如下信息:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'student.news' doesn't exist
我们打印出网页当前状态码是200,这应该是正常的状态码,为什么网页没有返回错误状态码500或者其他错误状态码

作者: qaz342xsw   发布时间: 2011-12-08

你把id=1 and (select count(*) from news)>=0封装成字符串嘛

String sWhere = "id=1 and (select count(*) from news)>=0" ;

"http://192.168.204.158:8080/mygold/show.jsp?where=" + sWhere ;




作者: cai5   发布时间: 2011-12-08

我们是这样做的,需要更详细的解释!

作者: qaz342xsw   发布时间: 2011-12-08

热门下载

更多