tt2
1 public String doLoginAction() throws Exception {
2 HttpServletResponse response = ServletActionContext.getResponse();
3 response.setHeader("Pragma", "No-cache");
4 response.setHeader("Cache-Control", "no-cache");
5 response.setDateHeader("Expires", 0);
6 try {
7 User loginUser =
8 UMUtils.getUserMgrLocal().login(user.getName(), user.getPassword().toCharArray());
9 /** 這里還要判斷用戶是否有效 */
10 if (loginUser == null) {
11 throw new Exception("用戶名密碼不正確,或者不在登陸有效期內,或已經被鎖");
12 }
13 ActionContext.getContext().getSession().put(OrgConstants.SESSION_USER, loginUser);
14 } catch (Exception e) {
15 throw new Exception("用戶名密碼不正確,或者不在登陸有效期內,或已經被鎖");
16
17 }
18 return SUCCESS;
19 }
20
2 HttpServletResponse response = ServletActionContext.getResponse();
3 response.setHeader("Pragma", "No-cache");
4 response.setHeader("Cache-Control", "no-cache");
5 response.setDateHeader("Expires", 0);
6 try {
7 User loginUser =
8 UMUtils.getUserMgrLocal().login(user.getName(), user.getPassword().toCharArray());
9 /** 這里還要判斷用戶是否有效 */
10 if (loginUser == null) {
11 throw new Exception("用戶名密碼不正確,或者不在登陸有效期內,或已經被鎖");
12 }
13 ActionContext.getContext().getSession().put(OrgConstants.SESSION_USER, loginUser);
14 } catch (Exception e) {
15 throw new Exception("用戶名密碼不正確,或者不在登陸有效期內,或已經被鎖");
16
17 }
18 return SUCCESS;
19 }
20