package com.java1234.action; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.apache.struts2.interceptor.ServletRequestAware; import com.java1234.dao.ManagerDao; import com.java1234.model.Manager; import com.java1234.model.Student; import com.opensymphony.xwork2.ActionSupport; public class ManagerAction extends ActionSupport implements ServletRequestAware{ /** * */ private static final long serialVersionUID = 1L; private HttpServletRequest request; private ManagerDao managerDao=new ManagerDao(); private Manager manager; private String error; public Manager getManager() { return manager; } public void setManager(Manager manager) { this.manager = manager; } public String getError() { return error; } public void setError(String error) { this.error = error; } /** * 登录验证 * @return * @throws Exception */ public String login()throws Exception{ HttpSession session=request.getSession(); Manager currentUser=managerDao.login(manager); if(currentUser==null){ error="用户名或者密码错误!"; return ERROR; }else{ session.setAttribute("currentUser", currentUser); return SUCCESS; } } /** * 注销用户 * @throws Exception */ public String logout()throws Exception{ request.getSession().invalidate(); return "logout"; } public void setServletRequest(HttpServletRequest request) { this.request=request; } }

weilaizhisheng LV21
2023年9月16日
似鹤不是鹤似鹤不是鹤 LV1
2023年5月5日
sswert LV2
2023年5月4日
amour1 LV11
2023年5月3日
tujf13763823976 LV3
2023年3月28日
fu8867 LV2
2023年2月20日
wubinbin LV11
2023年2月11日
shamexidan LV9
2022年5月20日
shibinf LV3
2022年4月8日
and123456 LV11
2022年2月7日

ldzhouyong
4月28日
暂无贡献等级
luhong LV2
3月31日
微信网友_7357533879193600 LV2
1月26日
416696772
2024年10月31日
暂无贡献等级
wangbh1234 LV1
2024年6月7日
pokerf LV5
2024年4月7日
taoshen95 LV16
2024年2月29日
gjw19884260466 LV3
2024年1月8日
WBelong LV8
2023年12月11日
cpla1998 LV8
2023年11月28日