Column was set to data type implicit default; NULL supplied for NOT NULL column 'password' at row 1
Tomcat报错
谁能帮我解释一下这个错误的信息 我做的功能是管理员修改密码~
代码如下~
package com.zr.entiy;
public class User {
private String username;
private String password;
private String newpwd;
public String getNewpwd() {
return newpwd;
}
public void setNewpwd(String newpwd) {
this.newpwd = newpwd;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
DAO层
public boolean updatePwd(User user){
String sql="select count(*) from user where username=? and password=?";
System.out.println(sql);
String usql="update user set password=? where username=?";
System.out.println(usql);
int count=jt.queryForInt(sql,new Object[]{user.getUsername(),user.getPassword()});
if(count>0){
jt.update(usql, new Object[]{user.getNewpwd(),user.getUsername() });
return true;
}
return false;
}
Action中
public String editPwd() throws Exception{
ActionContext context = ActionContext.getContext();
Map session = context.getSession();
User user = (User) session.get("user");
if(userService.updatePwd(user)){
return "success";
}else
return "fail" ;
}