BaseAction.java
资源名称:oa.rar [点击查看]
上传用户:kimgenplus
上传日期:2016-06-05
资源大小:20877k
文件大小:1k
源码类别:
OA系统
开发平台:
Java
- package com.bjsxt.oa.web.actions;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.apache.struts.action.ActionForm;
- import org.apache.struts.action.ActionForward;
- import org.apache.struts.action.ActionMapping;
- import org.apache.struts.actions.DispatchAction;
- import com.bjsxt.oa.model.User;
- public class BaseAction extends DispatchAction {
- @Override
- public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
- //添加权限判断的代码
- User user = (User)request.getSession().getAttribute("login");
- if(user == null){
- return mapping.findForward("login");
- }
- //继续父类的职责,即将请求分发到不同的方法中!
- return super.execute(mapping, form, request, response);
- }
- protected User currentUser(HttpServletRequest request){
- return (User)request.getSession().getAttribute("login");
- }
- }