Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement