1 7 package com.inversoft.verge.mvc.model.form; 8 9 10 import java.util.Map ; 11 12 import javax.servlet.http.HttpServletRequest ; 13 14 import com.inversoft.beans.BeanException; 15 import com.inversoft.verge.mvc.MVCException; 16 import com.inversoft.verge.mvc.MVCRequest; 17 import com.inversoft.verge.mvc.config.BaseFormConfig; 18 import com.inversoft.verge.mvc.controller.form.config.FormConfigStruct; 19 import com.inversoft.verge.mvc.model.ModelResolution; 20 import com.inversoft.verge.mvc.model.ModelResolver; 21 import com.inversoft.verge.util.WebBean; 22 23 24 38 public class FormModelResolver implements ModelResolver { 39 40 41 44 public FormModelResolver() { 45 super(); 46 } 47 48 49 61 public ModelResolution resolve(MVCRequest mvcRequest, String definition, 62 Map extraParams) 63 throws MVCException { 64 65 HttpServletRequest request = mvcRequest.getRequest(); 68 FormConfigStruct struct = (FormConfigStruct) mvcRequest.getConfiguration(); 69 BaseFormConfig config = struct.baseFormConfig; 70 FormMetaData md = new FormMetaData(definition); 71 WebBean formBean = config.getFormBean(md.getID()); 72 ModelResolution mr = null; 73 74 try { 75 mr = new ModelResolution(formBean.getInstance(request), md); 76 } catch (BeanException be) { 77 throw new MVCException(be); 78 } 79 80 return mr; 81 } 82 } 83 | Popular Tags |