求Java(不是jsp的)修改密码的一段程序代码,原密码,新密码,确认密码。 5
publicvoidclear(){txtUsername.setText("");psdOld.setText("");psdNew.setText("");psdOk...
public void clear(){
txtUsername.setText("");
psdOld.setText("");
psdNew.setText("");
psdOk.setText("");
}
public void resetPsd(){
Users user=new Users();
try {
// user.setUserID(userid.trim());
user.setUserName(txtUsername.getText().trim());
user.setPasswordCode(String.valueOf(psdNew.getPassword()).trim());
if(handUser.resetPsword(user)){
JOptionPane.showMessageDialog(this,"修改成功!","",JOptionPane.WARNING_MESSAGE);
clear();
}else {
JOptionPane.showMessageDialog(this,"修改失败请正确输入用户名","",JOptionPane.WARNING_MESSAGE);
}
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
}
public void selUserId(){
Users user=new Users();
try {
user.setUserName(txtUsername.getText().trim());
user.setPasswordCode(String.valueOf(psdOld.getPassword()).trim());
userid=handUser.selId(user);
if(!userid.equals("")){
}else{
JOptionPane.showMessageDialog(this,"核对您的用户名&密码","",JOptionPane.WARNING_MESSAGE);
psdOld.setText("");
psdOld.grabFocus();
}
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
}
public boolean chackUserpsd(){
Validate valid=new Validate();
if(!valid.stringValidate(String.valueOf(psdNew.getPassword()),String.valueOf(psdOk.getPassword()))){
return false;
}else{
return true;
}
}
这个里面只有新密码的确认,没有原密码的核对。
请各位高手帮帮忙……谢 展开
txtUsername.setText("");
psdOld.setText("");
psdNew.setText("");
psdOk.setText("");
}
public void resetPsd(){
Users user=new Users();
try {
// user.setUserID(userid.trim());
user.setUserName(txtUsername.getText().trim());
user.setPasswordCode(String.valueOf(psdNew.getPassword()).trim());
if(handUser.resetPsword(user)){
JOptionPane.showMessageDialog(this,"修改成功!","",JOptionPane.WARNING_MESSAGE);
clear();
}else {
JOptionPane.showMessageDialog(this,"修改失败请正确输入用户名","",JOptionPane.WARNING_MESSAGE);
}
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
}
public void selUserId(){
Users user=new Users();
try {
user.setUserName(txtUsername.getText().trim());
user.setPasswordCode(String.valueOf(psdOld.getPassword()).trim());
userid=handUser.selId(user);
if(!userid.equals("")){
}else{
JOptionPane.showMessageDialog(this,"核对您的用户名&密码","",JOptionPane.WARNING_MESSAGE);
psdOld.setText("");
psdOld.grabFocus();
}
} catch (NumberFormatException ex) {
ex.printStackTrace();
}
}
public boolean chackUserpsd(){
Validate valid=new Validate();
if(!valid.stringValidate(String.valueOf(psdNew.getPassword()),String.valueOf(psdOk.getPassword()))){
return false;
}else{
return true;
}
}
这个里面只有新密码的确认,没有原密码的核对。
请各位高手帮帮忙……谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询