这是我jsp中的代码:<%int cardidint =Integer.valueOf(request.getParameter("cardid"));System.out.print("卡号 为:"+cardidint);Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); Connection conn = DriverManager.getConnection("jdbc:sqlserver://localhost:1433;DatabaseName=eatery;user=sa;password=sasa;");Statement stmt = conn.createStatement();String sql="select cardID,name,balance from card where cardID='"+cardidint+"'";System.out.print("卡号验证成功");ResultSet rs=stmt.executeQuery(sql);if(rs.next()){session.setAttribute("cardid",cardidint);System.out.println("session中的cardid:"+cardidint);运行结果(部分):卡号 为:2230卡号验证成功实数i=4卡号 为:2555卡号验证成功session中的cardid:25552011-5-27 20:41:01 org.apache.catalina.core.StandardWrapperValve invoke严重: Servlet.service() for servlet jsp threw exceptionjava.lang.NumberFormatException: nullat java.lang.Integer.parseInt(Integer.java:417)at java.lang.Integer.valueOf(Integer.java:554)at org.apache.jsp.Checkcard_jsp._jspService(Checkcard_jsp.java:98)这是前一个JSP页面中的HTML代码 <th width="276" scope="col"><form name="cardidform" method="post" onSubmit="return Checkcard()"action="Checkcard.jsp"><p><label><span class="STYLE1">卡号 </span><input type="text" name="cardid" width="180" height="35"></label></p><p> </p><p> </p><p><input name="Submit" type="Submit" class="STYLE1" value="确定"></p>
2 回答
- 2 回答
- 0 关注
- 267 浏览
添加回答
举报
0/150
提交
取消