哪里为空
servletjsp做登录的程序
try
{
Statement sql1=conn.createStatement();
PreparedStatement sql=conn.prepareStatement(searchinfo);
if(boo)
{
sql.setString(1,username);
sql.setString(2,pwd);
ResultSet rs=sql.executeQuery();
boolean m=rs.next();
if(m==true)
{
out.println("登陆成功");
session.setMaxInactiveInterval(60000);
session.setAttribute("username",username);
String userid = rs.getString("userid");
session.setAttribute("userid", "userid");
session.setAttribute("fullname", rs.getString("fullname"));
session.setAttribute("logins", rs.getString("logins"));
session.setAttribute("rights", rs.getString("rights"));
session.setAttribute("depid", rs.getString("depid"));
session.setAttribute("mygroups", rs.getString("groups"));
String lastip = req.getRemoteAddr();
String dateTime = dateformat.format(date);
String update = "UPDATE userinfo SET lastlogin=to_date('"+dateTime+"','yyyy-MM-dd hh:mi:ss'),logins=logins+1 where userid=" + userid;
String update1 = "INSERT into Log(username,uptime,lastip,content) VALUES('" + username + "',to_date('"+dateTime+"','yyyy-MM-dd hh:mi:ss'),'" + lastip + "','登陆系统')";
int n = sql1.executeUpdate(update1);
int f = sql1.executeUpdate(update);
System.out.println(userid+username);
resp.sendRedirect("index.jsp");
}
else
{
out.println("<SCRIPT LANGUAGE=javascript>");
out.println("alert('用户名或密码错误!');");
out.println("window.location.href='default.jsp'; ");
out.println("</script>");
}
}
sql1.close();
sql.close();
conn.close();
}
catch(
SQLException e2)
{
e2.printStackTrace();
}
}
调试整个代码都可以运行,但是后面就报错为
java.lang.NumberFormatException: null at java.lang.Integer.parseInt(Integer.java:415)
at java.lang.Integer.parseInt(Integer.java:497)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:72)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
我不清楚哪个String为空了,该怎么找?
求助