loginaction.java~1~
来自「是一个不错的库存管理的源代码。实现了库存主要功能」· JAVA~1~ 代码 · 共 51 行
JAVA~1~
51 行
package com.order.action;
import org.apache.struts.action.*;
import javax.servlet.http.*;
import com.order.logic.LoginLogic;
import com.order.vo.User;
import com.order.vo.Customer;
public class LoginAction extends Action {
public ActionForward perform(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) {
/**@todo: complete the business logic here, this is just a skeleton.*/
String username = httpServletRequest.getParameter("username");
String password = httpServletRequest.getParameter("password");
System.out.println("username ==" + username);
System.out.println("password ==" + password);
LoginLogic logic = new LoginLogic();
User user = logic.passOrNot(username,password);
Customer customer = logic.getCustomer(user.getCustomerUID());
logic.closeDAO();
if(user!=null)
{
if(customer!=null)
{
HttpSession session = httpServletRequest.getSession(true);
session.setAttribute("pass", customer);
}
System.out.println("username====" + user.getUserName());
if(user.getUserType().intValue()==1)
{
return actionMapping.findForward("useraction");
}
if(user.getUserType().intValue()==2)
{
return actionMapping.findForward("customer");
}
if(user.getUserType().intValue()==3)
{
return actionMapping.findForward("manager");
}
}
System.out.println("aaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
return actionMapping.findForward("login");
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?