我的更新密碼查詢不起作用。我不知道爲什麼。沒有錯誤報告顯示。更新密碼不起作用
public class CpassDao extends ActionSupport {
private static final long serialVersionUID = 1L;
public static boolean validate(String username,String password,String npass) {
boolean status = false;
ChangePass cp = new ChangePass();
try {
Connection con = DBConnection.getConnection();
PreparedStatement ps = con.prepareStatement("select * from doctable where username=? and password=?");
ps.setString(1, username);
ps.setString(2, password);
ResultSet rs= ps.executeQuery();
status = rs.next();
if(true) {
PreparedStatement ps1 = con.prepareStatement("update details set password=? where username=?");
ps1.setString(1, cp.getNpass());
ps1.setString(2, cp.getUsername());
ps1.executeUpdate();
}
}
catch (Exception ex) {
ex.printStackTrace();
return status;
}
return status;
}
}
如何向相關用戶填充cp? – user7294900
我無法讓你清楚。 – Sathish