這是我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);運行結(jié)果(部分):卡號 為:2230卡號驗證成功實數(shù)i=4卡號 為:2555卡號驗證成功session中的cardid:25552011-5-27 20:41:01 org.apache.catalina.core.StandardWrapperValve invoke嚴(yán)重: 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>
以下是關(guān)于JSP的代碼,但是我在運行中,卻出現(xiàn)數(shù)字格式異常?該怎么辦?
叮當(dāng)貓咪
2021-07-19 18:14:23