List of usage examples for org.springframework.web.servlet.tags.form TagWriter endTag
public void endTag(boolean enforceClosingTag) throws JspException
From source file:org.hdiv.web.servlet.tags.form.SelectTagHDIV.java
/** * Renders the HTML '<code>select</code>' tag to the supplied * {@link TagWriter}./*from w w w .ja v a2s. c om*/ * <p>Renders nested '<code>option</code>' tags if the * {@link #setItems items} property is set, otherwise exposes the * bound value for the nested {@link OptionTag OptionTags}. */ @Override protected int writeTagContent(TagWriter tagWriter) throws JspException { dataComposer = (IDataComposer) this.pageContext.getRequest().getAttribute(TagUtils.DATA_COMPOSER); dataComposer.compose(this.getName(), "", false); tagWriter.startTag("select"); writeDefaultAttributes(tagWriter); if (isMultiple()) { tagWriter.writeAttribute("multiple", "multiple"); } tagWriter.writeOptionalAttributeValue("size", getDisplayString(evaluate("size", getSize()))); Object items = getItems(); if (items != null) { // Items specified, but might still be empty... if (items != EMPTY) { Object itemsObject = evaluate("items", items); if (itemsObject != null) { String valueProperty = (getItemValue() != null ? ObjectUtils.getDisplayString(evaluate("itemValue", getItemValue())) : null); String labelProperty = (getItemLabel() != null ? ObjectUtils.getDisplayString(evaluate("itemLabel", getItemLabel())) : null); OptionWriterHDIV optionWriter = new OptionWriterHDIV(dataComposer, this.getName(), itemsObject, getBindStatus(), valueProperty, labelProperty, isHtmlEscape()); optionWriter.writeOptions(tagWriter); } } tagWriter.endTag(true); writeHiddenTagIfNecessary(tagWriter); return SKIP_BODY; } else { // Using nested <form:option/> tags, so just expose the value in the PageContext... tagWriter.forceBlock(); this.tagWriter = tagWriter; this.pageContext.setAttribute(LIST_VALUE_PAGE_ATTRIBUTE, getBindStatus()); return EVAL_BODY_INCLUDE; } }