changepwaction.java
来自「struts hibernate框架 商场买卖」· Java 代码 · 共 37 行
JAVA
37 行
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.shopping.struts.action.user;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.shopping.bo.user.ChangePW;
import com.shopping.struts.form.RegisterForm;
public class ChangePwAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
RegisterForm changePwForm = (RegisterForm) form;// TODO Auto-generated method stub
String username = changePwForm.getUsername();
String oldPw = changePwForm.getOldPw();
String newPw = changePwForm.getPassword();
ChangePW c = new ChangePW();
if(c.checkPW(username, oldPw)){
c.updatePw(username,newPw);
request.setAttribute("info", "success");
return new ActionForward("/changePW.jsp");
} else {
request.setAttribute("info", "wrong");
return new ActionForward("/changePW.jsp");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?