做了一个注册页面,有add.jsp,register.jsp,function.java,运行register显示错误如:
message:AnexceptionoccurredprocessingJSPpage/add.jspatline23description:Theserverenco...
message:An exception occurred processing JSP page /add.jsp at line 23
description:The server encountered an internal error that prevented it from fulfilling this request.
org.apache.jasper.JasperException: An exception occurred processing JSP page /add.jsp at line 23
String id = request.getParameter("id");
String name = request.getParameter("name");
String age = request.getParameter("age");
String major = request.getParameter("major");
String college = request.getParameter("college");
20: ResultSet rs=null;
21: String str="select id,name,age,major,college from student where id='"+id+"';";
22: query.connect();
23: rs=query.select(str);
24: rs.last();
25: str="insert into student(id,name,age,major,college)values('"+id+"','"+name+"','"+age+"','"+major+"','"+college+"');";
26: query.update(str);
希望各位帮忙,真诚感谢 展开
description:The server encountered an internal error that prevented it from fulfilling this request.
org.apache.jasper.JasperException: An exception occurred processing JSP page /add.jsp at line 23
String id = request.getParameter("id");
String name = request.getParameter("name");
String age = request.getParameter("age");
String major = request.getParameter("major");
String college = request.getParameter("college");
20: ResultSet rs=null;
21: String str="select id,name,age,major,college from student where id='"+id+"';";
22: query.connect();
23: rs=query.select(str);
24: rs.last();
25: str="insert into student(id,name,age,major,college)values('"+id+"','"+name+"','"+age+"','"+major+"','"+college+"');";
26: query.update(str);
希望各位帮忙,真诚感谢 展开
5个回答
展开全部
21: String str="select id,name,age,major,college from student where id='"+id+"';";
改成 String str="select id,name,age,major,college from student where id='"+id+"'";
25:str="insert into student(id,name,age,major,college)values('"+id+"','"+name+"','"+age+"','"+major+"','"+college+"');";
改成str="insert into student(id,name,age,major,college)values('"+id+"','"+name+"','"+age+"','"+major+"','"+college+"')";
ps:只改了sql语句;还有楼主这个表建的很犀利神马都是string,确实很方便?
改成 String str="select id,name,age,major,college from student where id='"+id+"'";
25:str="insert into student(id,name,age,major,college)values('"+id+"','"+name+"','"+age+"','"+major+"','"+college+"');";
改成str="insert into student(id,name,age,major,college)values('"+id+"','"+name+"','"+age+"','"+major+"','"+college+"')";
ps:只改了sql语句;还有楼主这个表建的很犀利神马都是string,确实很方便?
追问
新手,不懂,高手你那有整个的注册代码吗(包含java类,jsp页面)
按照你说的跳过了,还是不行呀,我头都大了
十分感谢
展开全部
String str="select id,name,age,major,college from student where id='"+id+"';";
这个写错了吧,两个;了
应该是
String str="select id,name,age,major,college from student where id='"+id+"'";
这个写错了吧,两个;了
应该是
String str="select id,name,age,major,college from student where id='"+id+"'";
追问
还是不行
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
String str="select id,name,age,major,college from student where id='"+id+"';";
你的sql多了一个分号~~~
希望可以帮到你
还有我看的单引号好像是汉字的~~ 不过发过这上边看不太清楚 你自己看下
你的sql多了一个分号~~~
希望可以帮到你
还有我看的单引号好像是汉字的~~ 不过发过这上边看不太清楚 你自己看下
追问
改过了,还是不行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
看看各个页面的编码吧是否统一!!最好打印一下sql语句,看看里面有没有什么” ?? “之类的字符串,不然就算你再对都不会对的,jsp就是这个毛病,编码经常不对!!
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你的add.jsp里面的第23行有错,都给你说了出来的嘛
追问
那应该怎么改,谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询