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 import com.inversoft.verge.mvc.view.jsp.JspTools; 15 16 17 22 public class RadioTag extends com.inversoft.verge.mvc.view.jsp.html.RadioTag { 23 24 protected ModelResolution modelResolution; 25 26 27 32 public void initialize() throws JspException { 33 34 super.initialize(); 36 super.initializeKeyProperty(); 37 38 String tempName = null; 41 if (!hasName()) { 42 tempName = JspTools.getRadioName(localModel, pageContext); 43 if (tempName != null) { 44 localName = tempName; 45 } else { 46 JspTools.setRadioName(localModel, localName, pageContext); 49 } 50 } 51 52 modelResolution = ModelHelper.getModelResolution(key, property, pageContext); 53 if (modelResolution == null) { 54 throw new JspException ("Invalid model definition: " + getModel()); 55 } 56 } 57 58 63 public int doEndTag() throws JspException { 64 super.doEndTag(); 65 66 if (isSetValue()) { 67 ModelHelper.outputModelExtra(modelResolution.getMetaData(), localName, 68 pageContext); 69 } 70 71 return EVAL_PAGE; 72 } 73 74 85 protected void createRadioTag(StringBuffer buf, String id, String name, 86 Object value, Boolean checked) 87 throws JspException { 88 if (isGetValue()) { 89 Object valueObj = ModelHelper.getValue(modelResolution, pageContext); 90 checked = ObjectTools.areObjectsEqual(valueObj, value) ? 91 Boolean.TRUE : Boolean.FALSE; 92 } 93 94 super.createRadioTag(buf, id, name, value, checked); 95 } 96 } | Popular Tags |