📄 logintodifferaction.java
字号:
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package actionForm;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
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 bean.Employeeinfo;
import bean.Userinfo;
import dao.EmployeeinfoDAO;
import dao.UserinfoDAO;
public class LoginToDifferAction extends Action {
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
LoginForm login = (LoginForm) form;// TODO Auto-generated method stub
EmployeeinfoDAO empdao = new EmployeeinfoDAO();
UserinfoDAO userdao = new UserinfoDAO();
HttpSession session = request.getSession();
String name = login.getUsername();
String password = login.getPassword();
if(name == null||password == null || name == "" || password == ""){
return mapping.findForward("error");
}
if(userdao.checkUser(name)){
Userinfo user = userdao.quaryByusername(name);
if(user.getUserpass().equals(password)){
session.setAttribute("username", name);
return mapping.findForward("userSuccess");
}
}
// if(empdao.checkEmployee(name)){
// Employeeinfo emp = empdao.quaryByEmployeeid(name);
// if(emp.getEmployeepass().equals(password))
// {
// if(emp.getDutyinfo().getDutyid() == 1000){
// session.setAttribute("username", name);
// return mapping.findForward("transportmanagerIndex");
// }
// if(emp.getDutyinfo().getDutyid() == 1001){
// session.setAttribute("username", name);
// return mapping.findForward("market");
// }
// if(emp.getDutyinfo().getDutyid() == 1002){
// session.setAttribute("username", name);
// return mapping.findForward("dispatchCenter");
// }
// if(emp.getDutyinfo().getDutyid() == 1003){
// session.setAttribute("username", name);
// return mapping.findForward("warehouse");
// }
// if(emp.getDutyinfo().getDutyid() == 1004){
// session.setAttribute("username", name);
// return mapping.findForward("transportmanagerIndex");
// }
// if(emp.getDutyinfo().getDutyid() == 1005){
// session.setAttribute("username", name);
// return mapping.findForward("transportmanagerIndex");
// }
// }
//
// }
return mapping.findForward("error");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -