1 7 package com.inversoft.verge.mvc.view.jsp.model; 8 9 10 import javax.servlet.jsp.JspException ; 11 12 import com.inversoft.verge.mvc.model.ModelResolution; 13 14 15 20 public class TextAreaTag extends com.inversoft.verge.mvc.view.jsp.html.TextAreaTag { 21 22 protected ModelResolution modelResolution; 23 24 25 30 public void initialize() throws JspException { 31 32 super.initialize(); 34 super.initializeKeyProperty(); 35 36 modelResolution = ModelHelper.getModelResolution(key, property, pageContext); 37 if (modelResolution == null) { 38 throw new JspException ("Invalid model definition: " + getModel()); 39 } 40 } 41 42 47 public int doAfterBody() throws JspException { 48 49 Object bean = modelResolution.getModel(); 50 assert (bean != null) : "bean == null"; 51 52 Object value = null; 53 if (isGetValue()) { 54 value = ModelHelper.getValue(modelResolution, pageContext); 55 } 56 57 if (value != null) { 58 localText = value.toString(); 59 } else { 60 super.doAfterBody(); 61 } 62 63 return SKIP_BODY; 64 } 65 66 75 protected void createTextAreaTag(StringBuffer buf, String id, String name, 76 String text) 77 throws JspException { 78 Object bean = modelResolution.getModel(); 79 assert (bean != null) : "bean == null"; 80 81 if (isGetValue()) { 82 Object value = ModelHelper.getValue(modelResolution, pageContext); 83 if (value != null) { 84 text = value.toString(); 85 } 86 } 87 88 89 super.createTextAreaTag(buf, id, name, text); 90 } 91 92 97 public int doEndTag() throws JspException { 98 super.doEndTag(); 99 if (isSetValue()) { 100 ModelHelper.outputModelExtra(modelResolution.getMetaData(), localName, 101 pageContext); 102 } 103 104 return EVAL_PAGE; 105 } 106 } | Popular Tags |