1 7 package com.inversoft.verge.mvc.view.jsp.model; 8 9 10 import javax.servlet.jsp.JspException ; 11 12 import com.inversoft.util.ObjectTools; 13 import com.inversoft.verge.mvc.model.ModelResolution; 14 15 16 21 public class CheckboxTag extends com.inversoft.verge.mvc.view.jsp.html.CheckboxTag { 22 23 protected ModelResolution modelResolution; 24 25 26 30 public void initialize() throws JspException { 31 super.initialize(); 32 super.initializeKeyProperty(); 33 34 modelResolution = ModelHelper.getModelResolution(key, property, pageContext); 35 if (modelResolution == null) { 36 throw new JspException ("Invalid model definition: " + getModel()); 37 } 38 } 39 40 51 protected void createCheckboxTag(StringBuffer buf, String id, String name, 52 Object value, Boolean checked) 53 throws JspException { 54 if (isGetValue()) { 55 Object modelValue = ModelHelper.getValue(modelResolution, pageContext); 56 checked = ObjectTools.areObjectsEqual(modelValue, value) ? 57 Boolean.TRUE : Boolean.FALSE; 58 } 59 60 super.createCheckboxTag(buf, id, name, value, checked); 61 } 62 63 67 public int doEndTag() throws JspException { 68 super.doEndTag(); 69 if (isSetValue()) { 70 ModelHelper.outputModelExtra(modelResolution.getMetaData(), localName, 71 pageContext); 72 } 73 74 return EVAL_PAGE; 75 } 76 } | Popular Tags |