1 7 package com.inversoft.verge.mvc.view.jsp.html; 8 9 10 import java.io.IOException ; 11 12 import javax.servlet.jsp.JspException ; 13 14 import org.apache.log4j.Logger; 15 16 import com.inversoft.verge.mvc.view.HtmlConstants; 17 import com.inversoft.verge.mvc.view.HtmlViewToolkit; 18 import com.inversoft.verge.mvc.view.jsp.JspTools; 19 20 21 26 public class TextAreaTag extends InputTag { 27 28 31 private static final Logger logger = Logger.getLogger(TextAreaTag.class); 32 33 34 private String text; 35 protected String localText; 36 private Integer rows; 37 private Integer cols; 38 39 40 45 public Integer getRows() { 46 return rows; 47 } 48 49 54 public void setRows(Integer rows) { 55 this.rows = rows; 56 } 57 58 63 public Integer getCols() { 64 return cols; 65 } 66 67 72 public void setCols(Integer cols) { 73 this.cols = cols; 74 } 75 76 81 public String getText() { 82 return text; 83 } 84 85 90 public void setText(String text) { 91 this.text = text; 92 } 93 94 97 protected void initialize() throws JspException { 98 super.initialize(); 99 100 localText = text; 101 if (!JspTools.JSP_20) { 102 localText = (String ) JspTools.expand("text", text, String .class, 103 this, pageContext); 104 } 105 106 attributes.put(HtmlConstants.ROWS, rows); 107 attributes.put(HtmlConstants.COLS, cols); 108 } 109 110 113 public int doStartTag() throws JspException { 114 115 initialize(); 117 118 return EVAL_BODY_BUFFERED; 119 } 120 121 124 public int doAfterBody() throws JspException { 125 if (bodyContent != null) { 126 localText = bodyContent.getString(); 127 if (localText != null && JspTools.JSP_20) { 128 localText = (String ) JspTools.expand("text", localText, 129 String .class, this, pageContext); 130 } 131 } 132 133 return SKIP_BODY; 134 } 135 136 141 public int doEndTag() throws JspException { 142 143 StringBuffer buf = new StringBuffer (); 144 createTextAreaTag(buf, getId(), localName, localText); 145 146 try { 147 pageContext.getOut().print(buf.toString()); 148 } catch (IOException ioe) { 149 throw new JspException (ioe.toString()); 150 } 151 152 return EVAL_PAGE; 153 } 154 155 166 protected void createTextAreaTag(StringBuffer buf, String id, String name, 167 String text) 168 throws JspException { 169 HtmlViewToolkit.createTextAreaTag(buf, id, name, text, attributes, 170 singleAttrs); 171 172 if (logger.isDebugEnabled()) { 173 logger.debug("The text area tag: " + buf.toString()); 174 } 175 } 176 } | Popular Tags |