1 7 package com.inversoft.verge.mvc.controller.form; 8 9 10 import javax.servlet.ServletRequest ; 11 12 import com.inversoft.verge.mvc.MVCException; 13 import com.inversoft.verge.mvc.config.BaseFormConfig; 14 import com.inversoft.verge.mvc.config.BaseFormConfigMetaData; 15 import com.inversoft.verge.mvc.controller.form.config.FormMVCConfigRegistry; 16 17 18 26 public class FormMVCMetaData extends BaseFormConfigMetaData { 27 28 private String action; 29 30 33 FormMVCMetaData() { 34 } 36 37 43 public FormMVCMetaData(String form, String action) { 44 super(form); 45 this.action = action; 46 } 47 48 49 54 public void setForm(String form) { 55 this.form = form; 56 } 57 58 63 public String getAction() { 64 return action; 65 } 66 67 72 public void setAction(String action) { 73 this.action = action; 74 } 75 76 88 public BaseFormConfig findFormConfig(ServletRequest request) 89 throws MVCException { 90 String formName = getForm(); 91 if (formName == null) { 92 throw new MVCException("Form name not specified"); 93 } 94 95 BaseFormConfig config = 96 FormMVCConfigRegistry.getInstance(request).lookupForm(formName); 97 if (config == null) { 98 throw new MVCException("Invalid form name: " + formName); 99 } 100 101 return config; 102 } 103 } | Popular Tags |