📄 actlogin.java
字号:
/*
* Created on 2009-5-4
*
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package cn.edu.zucc.struts.app01;
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;
/**
* @author Administrator
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ActLogin extends Action {
public ActionForward execute(ActionMapping arg0, ActionForm arg1,
HttpServletRequest arg2, HttpServletResponse arg3) throws Exception {
// TODO Auto-generated method stub
System.out.println("1-");
ActfrmLogin userinfo = (ActfrmLogin) arg1;
boolean flag = true;
UserDAO userdao = new UserDAO();
String a = userinfo.getUserid();
ActfrmLogin dd = userdao.readUser(a);
try {
if (dd == null) {
flag = false;
throw new Exception("用户不存在");
} else {
System.out.println(dd.getPwd());
if (!dd.getPwd().equals(userinfo.getPwd())) {
flag = false;
throw new Exception("密码错误");
} else {
flag = true;
}
}
} catch (Exception ex) {
arg2.setAttribute("errormsg", ex.getMessage());
}
if (flag)
return arg0.findForward("loginOk");
else
return arg0.findForward("loginFail");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -