1 16 17 package org.springframework.web.servlet.tags.form; 18 19 import javax.servlet.jsp.JspException ; 20 21 29 public class InputTag extends AbstractHtmlInputElementTag { 30 31 34 public static final String MAXLENGTH_ATTRIBUTE = "maxlength"; 35 36 39 public static final String ALT_ATTRIBUTE = "alt"; 40 41 44 public static final String ONSELECT_ATTRIBUTE = "onselect"; 45 46 49 public static final String SIZE_ATTRIBUTE = "size"; 50 51 54 public static final String READONLY_ATTRIBUTE = "readonly"; 55 56 57 60 private String maxlength; 61 62 65 private String alt; 66 67 70 private String onselect; 71 72 75 private String size; 76 77 80 private String readonly; 81 82 83 87 public void setMaxlength(String maxlength) { 88 this.maxlength = maxlength; 89 } 90 91 94 protected String getMaxlength() { 95 return this.maxlength; 96 } 97 98 102 public void setAlt(String alt) { 103 this.alt = alt; 104 } 105 106 109 protected String getAlt() { 110 return this.alt; 111 } 112 113 117 public void setOnselect(String onselect) { 118 this.onselect = onselect; 119 } 120 121 124 protected String getOnselect() { 125 return this.onselect; 126 } 127 128 132 public void setSize(String size) { 133 this.size = size; 134 } 135 136 139 protected String getSize() { 140 return this.size; 141 } 142 143 147 public void setReadonly(String readonly) { 148 this.readonly = readonly; 149 } 150 151 154 protected String getReadonly() { 155 return this.readonly; 156 } 157 158 163 protected String getType() { 164 return "text"; 165 } 166 167 168 173 protected int writeTagContent(TagWriter tagWriter) throws JspException { 174 tagWriter.startTag("input"); 175 writeDefaultAttributes(tagWriter); 176 tagWriter.writeAttribute("type", getType()); 177 writeValue(tagWriter); 178 179 writeOptionalAttribute(tagWriter, SIZE_ATTRIBUTE, getSize()); 181 writeOptionalAttribute(tagWriter, MAXLENGTH_ATTRIBUTE, getMaxlength()); 182 writeOptionalAttribute(tagWriter, ALT_ATTRIBUTE, getAlt()); 183 writeOptionalAttribute(tagWriter, ONSELECT_ATTRIBUTE, getOnselect()); 184 writeOptionalAttribute(tagWriter, READONLY_ATTRIBUTE, getReadonly()); 185 tagWriter.endTag(); 186 return EVAL_PAGE; 187 } 188 189 194 protected void writeValue(TagWriter tagWriter) throws JspException { 195 tagWriter.writeAttribute("value", getDisplayString(getBoundValue(), getPropertyEditor())); 196 } 197 198 } 199 | Popular Tags |