UserAction
来源:互联网 发布:高级网络管理 编辑:程序博客网 时间:2024/05/21 06:19
`package cn.bdqn.jboa.action;
import java.util.Map;
import cn.bdqn.jboa.entity.Employee;
import cn.bdqn.jboa.service.EmployeeService;
import cn.bdqn.jboa.utils.MD5;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
/**
* 用户登录action。
*
* @author 北大青鸟
* @version 1.0
*/
public class UserAction extends ActionSupport {
private static final long serialVersionUID = -6095372451084071851L;private Employee employee = null;private EmployeeService employeeService = null;/** * 用户登录。 * * @return * @throws Exception */public String login() throws Exception { Employee newEmployee = null; try { // 对登录密码进行MD5加密 // employee.setPassword(new MD5(employee.getPassword()).compute()); newEmployee = employeeService.login(employee); } catch (Exception e) { this.addActionMessage(e.getMessage()); } String ret = INPUT; if (newEmployee == null) { ret = INPUT; } else { Map<String, Object> session = ActionContext.getContext() .getSession(); session.put("employee", newEmployee); String nameCn = newEmployee.getPosition().getNameCn(); if ("普通员工".equals(nameCn)) { ret = "staff"; } else if ("部门经理".equals(nameCn)) { ret = "deptManager"; } else if ("总经理".equals(nameCn)) { ret = "manager"; } else if ("财务".equals(nameCn)) { ret = "cashier"; } } return ret;}/** * 用户退出。 * * @return * @throws Exception */public String logout() throws Exception { ActionContext ac = ActionContext.getContext(); ac.getSession().remove("employee"); return SUCCESS;}public void setEmployee(Employee employee) { this.employee = employee;}public void setEmployeeService(EmployeeService employeeService) { this.employeeService = employeeService;}public Employee getEmployee() { return employee;}public EmployeeService getEmployeeService() { return employeeService;}
}
0 0
- UserAction
- Unable to instantiate Action, UserAction
- UserAction类中使用JsonObject
- Action class [userAction] not found
- Action class [userAction] not found - action
- 出现异常提示 Action class [userAction] not found - action
- UserAction extends ActionSupport implements ModelDriven<User> .tmp 上传图片文件
- No result defined for action action.UserAction and result input
- java.lang.NoSuchMethodException: com.gxuwz.aiImage.web.struts.UserAction.user()
- 注册时后台验证UserAction-regUser-validation.xml
- There is no Action mapped for namespace / and action name UserAction
- No result defined for action com.svse.action.UserAction and result input
- J2EE Struts2关于"There is no Action mapped for namespace / and action name UserAction"的调试
- <action name="userAction_save" class="app.converter.UserAction" method="save">
- Struts Problem Report java.lang.NullPointerException com.niit.ssh2.action.UserAction.login(Use
- SSH报错:No result defined for action com.tyzy.action.user.UserAction and result input
- No result defined for action com.web.action.UserAction and result input
- struts2 在拦截器里报错:No result defined for action com.gkwl.action.UserAction and result input
- 高性能网站建设的14个原则
- Android基本问题汇总
- Codeforces 103A Testing Pants for Sadness
- java SE---String--好记性不如烂笔头
- 一个VR游戏DEMO的开发历程是怎样的?
- UserAction
- 常见的几种布局总结
- poj1961 Period
- android学习经历---------Activity四种启动模式
- 富文本使用的2种方式
- mysql语法速查
- Dynamic Programming
- 单链表的就地逆制
- [HDU5741] Helter Skelter [2016 Multi-University Training Contest 2(2016多校联合训练2) H]