1 16 package dlog4j.action; 17 18 import javax.servlet.http.HttpServletRequest ; 19 import javax.servlet.http.HttpServletResponse ; 20 21 import org.apache.struts.action.ActionErrors; 22 import org.apache.struts.action.ActionForm; 23 import org.apache.struts.action.ActionForward; 24 import org.apache.struts.action.ActionMapping; 25 26 import dlog4j.Globals; 27 import dlog4j.formbean.UserForm; 28 29 33 public class AdminActionBase extends DlogActionBase { 34 35 38 public ActionForward execute(ActionMapping mapping, ActionForm form, 39 HttpServletRequest req, HttpServletResponse res) throws Exception 40 { 41 UserForm user = getLoginUser(req); 42 if(user==null || !user.isAdmin()) 43 return mapping.findForward("admin_access_deny"); 44 45 ActionForward forward = null; 46 if(form!=null){ 48 ActionErrors errors = form.validate(mapping, req); 49 if(errors!=null && !errors.isEmpty()){ 50 saveErrors(req, errors); 51 forward = mapping.getInputForward(); 52 } 53 } 54 if(forward==null) 55 forward = super.execute(mapping,form,req,res); 56 if(!forward.getRedirect()){ 58 req.setAttribute(Globals.ACTION_PATH_KEY, forward.getPath()); 60 } 61 return forward; 62 } 63 64 } 65 | Popular Tags |