求大神解答关于jsp数据库连接抛出空指针异常 10
错误信息:java.lang.NullPointerExceptiondatabase.ConnDB.doUpdate(ConnDB.java:42)LoginBean....
错误信息:java.lang.NullPointerException
database.ConnDB.doUpdate(ConnDB.java:42)
LoginBean.mybean.check(mybean.java:23)
LoginServlet.myservlet.doPost(myservlet.java:16)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
代码如下:
package LoginBean;
import database.ConnDB;
import java.sql.*;
public class mybean {
private String name=null;
private String pwd=null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public int check(){
String sql="insert into zhuce values('"+name+"','"+pwd+
"')";
int rsesult=ConnDB.doUpdate(sql);
if(rsesult!=0){
return 1;
}else{
return 0;
}
}
} 展开
database.ConnDB.doUpdate(ConnDB.java:42)
LoginBean.mybean.check(mybean.java:23)
LoginServlet.myservlet.doPost(myservlet.java:16)
javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
代码如下:
package LoginBean;
import database.ConnDB;
import java.sql.*;
public class mybean {
private String name=null;
private String pwd=null;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
public int check(){
String sql="insert into zhuce values('"+name+"','"+pwd+
"')";
int rsesult=ConnDB.doUpdate(sql);
if(rsesult!=0){
return 1;
}else{
return 0;
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询