1 23 24 package org.dbforms.taglib; 25 26 import javax.servlet.jsp.JspException ; 27 28 29 30 39 public class DbTextAreaTag extends DbBaseInputTag 40 implements javax.servlet.jsp.tagext.TryCatchFinally { 41 42 protected String renderBody; 43 44 45 protected String wrap; 46 47 52 public void setRenderBody(String renderBody) { 53 this.renderBody = renderBody; 54 } 55 56 57 62 public String getRenderBody() { 63 return renderBody; 64 } 65 66 67 72 public void setWrap(String wrap) { 73 this.wrap = wrap; 74 } 75 76 77 82 public String getWrap() { 83 return wrap; 84 } 85 86 87 90 public void doCatch(Throwable t) throws Throwable { 91 throw t; 92 } 93 94 95 103 public int doEndTag() throws javax.servlet.jsp.JspException { 104 try { 105 if ("true".equals(renderBody) && (bodyContent != null)) { 106 bodyContent.writeOut(bodyContent.getEnclosingWriter()); 107 bodyContent.clearBody(); } 109 110 pageContext.getOut() 111 .write("</textArea>"); 112 113 writeOutSpecialValues(); 115 116 getParentForm() 118 .addChildName(getName(), getFormFieldName()); 119 } catch (java.io.IOException ioe) { 120 throw new JspException ("IO Error: " + ioe.getMessage()); 121 } 122 123 return EVAL_PAGE; 124 } 125 126 127 130 public void doFinally() { 131 wrap = null; 132 renderBody = null; 133 super.doFinally(); 134 } 135 136 137 145 public int doStartTag() throws javax.servlet.jsp.JspException { 146 super.doStartTag(); 147 148 StringBuffer tagBuf = new StringBuffer ("<textarea "); 149 150 tagBuf.append(prepareName()); 151 152 if (wrap != null) { 153 tagBuf.append(" wrap=\""); 154 tagBuf.append(wrap); 155 tagBuf.append("\""); 156 } 157 158 if (getCols() != null) { 159 tagBuf.append(" cols=\""); 160 tagBuf.append(getCols()); 161 tagBuf.append("\""); 162 } 163 164 if (getRows() != null) { 165 tagBuf.append(" rows=\""); 166 tagBuf.append(getRows()); 167 tagBuf.append("\""); 168 } 169 170 tagBuf.append(prepareKeys()); 171 tagBuf.append(prepareStyles()); 172 tagBuf.append(prepareEventHandlers()); 173 tagBuf.append(">"); 174 175 178 if (!"true".equals(renderBody)) { 179 tagBuf.append(escapeHTML(getFormFieldValue())); 180 } 181 182 try { 183 pageContext.getOut() 184 .write(tagBuf.toString()); 185 } catch (java.io.IOException e) { 186 throw new JspException ("IO Error: " + e.getMessage()); 187 } 188 189 if (!"true".equals(renderBody)) { 190 return EVAL_BODY_BUFFERED; 191 } else { 192 return SKIP_BODY; 193 } 194 } 195 } 196 | Popular Tags |