1 5 6 package org.infohazard.maverick.ctl; 7 8 import org.infohazard.maverick.flow.*; 9 import org.apache.commons.beanutils.BeanUtils; 10 import org.jdom.Element; 11 import javax.servlet.*; 12 13 20 public abstract class FormBeanUser implements ControllerSingleton 21 { 22 25 public static final String SUCCESS = "success"; 26 27 30 public static final String ERROR = "error"; 31 32 39 public void init(Element controllerNode) throws ConfigException 40 { 41 } 43 44 50 public final String go(ControllerContext cctx) throws ServletException 51 { 52 try 53 { 54 Object formBean = this.makeFormBean(cctx); 55 56 BeanUtils.populate(formBean, cctx.getRequest().getParameterMap()); 57 BeanUtils.populate(formBean, cctx.getControllerParams()); 58 59 cctx.setModel(formBean); 60 61 return this.perform(formBean, cctx); 62 } 63 catch (ServletException ex) 64 { 65 throw ex; 66 } 67 catch (Exception ex) 68 { 69 throw new ServletException(ex); 70 } 71 } 72 73 82 protected String perform(Object formBean, ControllerContext cctx) throws Exception 83 { 84 return SUCCESS; 85 } 86 87 92 protected abstract Object makeFormBean(ControllerContext cctx); 93 } | Popular Tags |