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 19 20 26 public class SelectTag extends InputTag { 27 28 29 private static final Logger logger = Logger.getLogger(SelectTag.class); 30 31 private Boolean multiple; 32 33 34 37 public SelectTag() { 38 } 40 41 42 47 public Boolean getMultiple() { 48 return multiple; 49 } 50 51 56 public void setMultiple(Boolean multiple) { 57 this.multiple = multiple; 58 } 59 60 67 protected void initialize() throws JspException { 68 super.initialize(); 69 70 if (multiple != null && multiple.booleanValue()) { 71 singleAttrs.add(HtmlConstants.MULTIPLE); 72 } 73 } 74 75 81 public int doStartTag() throws JspException { 82 83 logger.debug("Starting the select tag"); 84 85 initialize(); 87 88 StringBuffer buf = new StringBuffer (); 89 createSelectTag(buf, getId(), localName); 90 91 try { 92 pageContext.getOut().print(buf.toString()); 93 } catch (IOException ioe) { 94 throw new JspException (ioe.toString()); 95 } 96 97 return EVAL_BODY_INCLUDE; 98 } 99 100 107 protected void createSelectTag(StringBuffer buf, String id, String name) 108 throws JspException { 109 HtmlViewToolkit.createSelectStartTag(buf, id, name, attributes, 110 singleAttrs); 111 112 if (logger.isDebugEnabled()) { 113 logger.debug("The select tag: " + buf.toString()); 114 } 115 } 116 117 122 public int doEndTag() throws JspException { 123 124 logger.debug("Outputting the select end tag"); 125 126 try { 127 pageContext.getOut().print(HtmlConstants.SELECT_END_TAG); 128 } catch (IOException ioe) { 129 throw new JspException (ioe.toString()); 130 } 131 132 return EVAL_PAGE; 133 } 134 } 135 | Popular Tags |