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 com.inversoft.verge.mvc.view.HtmlConstants; 15 import com.inversoft.verge.mvc.view.HtmlViewToolkit; 16 import com.inversoft.verge.mvc.view.jsp.JspTools; 17 18 19 38 public class ImgTag extends ContextBasedTag { 39 40 private String src; 41 protected String localSrc; 42 private String longdesc; 43 protected String localLongdesc; 44 private String width; 45 protected String localWidth; 46 private String height; 47 protected String localHeight; 48 private String border; 49 protected String localBorder; 50 private String usemap; 51 protected String localUsemap; 52 private String ismap; 53 protected String localIsmap; 54 55 56 61 public String getSrc() { 62 return src; 63 } 64 65 70 public void setSrc(String src) { 71 this.src = src; 72 } 73 74 79 public String getLongdesc() { 80 return longdesc; 81 } 82 83 88 public void setLongdesc(String longdesc) { 89 this.longdesc = longdesc; 90 } 91 92 97 public String getWidth() { 98 return width; 99 } 100 101 106 public void setWidth(String width) { 107 this.width = width; 108 } 109 110 115 public String getHeight() { 116 return height; 117 } 118 119 124 public void setHeight(String height) { 125 this.height = height; 126 } 127 128 133 public String getBorder() { 134 return border; 135 } 136 137 142 public void setBorder(String border) { 143 this.border = border; 144 } 145 146 151 public String getUsemap() { 152 return usemap; 153 } 154 155 160 public void setUsemap(String usemap) { 161 this.usemap = usemap; 162 } 163 164 169 public String getIsmap() { 170 return ismap; 171 } 172 173 178 public void setIsmap(String ismap) { 179 this.ismap = ismap; 180 } 181 182 187 protected void initialize() throws JspException { 188 super.initialize(); 189 190 localSrc = src; 191 localLongdesc = longdesc; 192 localLongdesc = longdesc; 193 localWidth = width; 194 localHeight = height; 195 localBorder = border; 196 localUsemap = usemap; 197 localIsmap = ismap; 198 199 if (!JspTools.JSP_20) { 200 localSrc = (String ) JspTools.expand("src", src, String .class, this, 201 pageContext); 202 localLongdesc = (String ) JspTools.expand("longdesc", longdesc, 203 String .class, this, pageContext); 204 localWidth = (String ) JspTools.expand("width", width, String .class, 205 this, pageContext); 206 localHeight = (String ) JspTools.expand("height", height, 207 String .class, this, pageContext); 208 localBorder = (String ) JspTools.expand("border", border, 209 String .class, this, pageContext); 210 localUsemap = (String ) JspTools.expand("usemap", usemap, 211 String .class, this, pageContext); 212 localIsmap = (String ) JspTools.expand("ismap", ismap, 213 String .class, this, pageContext); 214 } 215 216 attributes.put(HtmlConstants.LONG_DESC, longdesc); 217 attributes.put(HtmlConstants.WIDTH, width); 218 attributes.put(HtmlConstants.HEIGHT, height); 219 attributes.put(HtmlConstants.BORDER, border); 220 attributes.put(HtmlConstants.USE_MAP, usemap); 221 attributes.put(HtmlConstants.IS_MAP, ismap); 222 } 223 224 227 public int doStartTag() throws JspException { 228 229 initialize(); 230 231 StringBuffer buf = new StringBuffer (128); 232 createImgTag(buf, getId(), localName, localSrc); 233 234 try { 235 pageContext.getOut().write(buf.toString()); 236 } catch (IOException ioe) { 237 throw new JspException (ioe); 238 } 239 240 return SKIP_BODY; 241 } 242 243 252 protected void createImgTag(StringBuffer buf, String id, String name, 253 String src) 254 throws JspException { 255 StringBuffer url = new StringBuffer (); 256 appendContextPlusURL(url, src); 257 src = url.toString(); 258 259 HtmlViewToolkit.createImgTag(buf, id, name, src, attributes, singleAttrs); 260 } 261 } | Popular Tags |