1 15 16 package com.jdon.strutsutil; 17 18 import javax.servlet.http.HttpServletRequest ; 19 import javax.servlet.http.HttpServletResponse ; 20 21 import org.apache.struts.action.ActionForm; 22 import org.apache.struts.action.ActionForward; 23 import org.apache.struts.action.ActionMapping; 24 import org.apache.struts.action.ActionMessage; 25 import org.apache.struts.action.ActionMessages; 26 27 import com.jdon.controller.model.ModelIF; 28 import com.jdon.model.ModelForm; 29 import com.jdon.util.Debug; 30 31 45 public class ModelDispAction extends ModelBaseAction { 46 47 private final static String module = ModelDispAction.class.getName(); 48 49 public ActionForward execute(ActionMapping actionMapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) 50 throws Exception { 51 52 Debug.logVerbose("[JdonFramework]--> enter ModelDispAction process ", module); 53 intContext(this.getServlet().getServletContext()); 54 55 ModelForm modelForm = FormBeanUtil.getModelForm(actionMapping, actionForm, request); 56 57 ModelIF model = viewPageUtil.getModelForEdit(actionMapping, modelForm, request); 58 59 if (model == null) { ActionMessages errors = new ActionMessages(); 61 Debug.logError("[JdonFramework]id.notfound in database", module); 62 ActionMessage error = new ActionMessage("id.notfound"); 63 errors.add(ActionMessages.GLOBAL_MESSAGE, error); 64 saveErrors(request, errors); 65 ActionForward af = actionMapping.findForward(FormBeanUtil.FORWARD_FAILURE_NAME); 66 if (af != null) 67 return af; 68 else 69 return actionMapping.findForward(FormBeanUtil.FORWARD_SUCCESS_NAME); 70 } else { 71 return actionMapping.findForward(FormBeanUtil.FORWARD_SUCCESS_NAME); 72 } 73 74 } 75 76 77 78 } 79 | Popular Tags |