📄 chengeaction.java
字号:
package com.brothers.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.brothers.dao.DaoFactory;
import com.brothers.dao.IUserDAO;
import com.brothers.form.ChengeActionForm;
import com.brothers.model.User;
import com.brothers.util.AuthorityUtil;
import com.brothers.util.UserInfo;
public class ChengeAction extends BaseAction {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
ChengeActionForm chengeForm = (ChengeActionForm) form;
UserInfo ui = (UserInfo)AuthorityUtil.getUser(request);
IUserDAO dao = DaoFactory.getUserDAO();
User ub = (User)dao.getUserById(ui.getUserId());
if(ub.getUserPwd().equals(chengeForm.getOldUserPwd())){
ub.setUserPwd(chengeForm.getNewUserPwd());
dao.updateUser(ub);
}
request.setAttribute("chengeresult", "true");
return mapping.findForward("chenge");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -