jsp 检查多表的多条件if.. else语句

来源:百度知道 编辑:UC知道 时间:2024/07/04 13:26:28
有一段代码,用if else判断条件是否符合老师出错,请高手指教
String op = request.getParameter("op");
if(op!=null&&op.equals("show")){
String s_currentpage =request.getParameter("currentpage");
String stuid = request.getParameter("studentid");
int deid = Integer.parseInt(request.getParameter("timuid"));
rs2=stmt.executeQuery("select * from xuanti_final where Student_id='"+stuid+"'");
if(rs2.next()){
response.sendRedirect("haschoiced.jsp");}
rs=stmt.executeQuery("select * from xuanti_now where Student_id='"+stuid+"' and Timu_id='"+deid +"'");
if(rs.next()){
response.sendRedirect("choiceerror.jsp");}
else{
stmt.executeUpdate("insert into xuanti_now(Student_id,Timu_id)"+
"values('"+stuid+"','"+deid +"')");
PreparedStatement choices

stmt.executeUpdate("insert into xuanti_now(Student_id,Timu_id)"+
"values('"+stuid+"','"+deid +"')"); 你这里的stuid和deid是获取不到的,因为String s_currentpage =request.getParameter("currentpage");
String stuid = request.getParameter("studentid"); 这2个变量是声明在if语句里的,而else是取不到 把他们写在if外面

设断点看看

具体报什么错了?