List of usage examples for org.springframework.web.servlet.tags.form TagWriter writeAttribute
public void writeAttribute(String attributeName, String attributeValue) throws JspException
From source file:com.benfante.taglib.frontend.tags.BootstrapTagHelper.java
/** * Writes the opening '/*ww w .ja va 2s.c o m*/ * <code>p</code>' tag and forces a block tag so that field prefix/suffix is * written correctly. */ public static void writeInputTagHelpBlock(final TagWriter tagWriter, final String text) throws JspException { if (StringUtils.hasText(text)) { tagWriter.startTag("p"); tagWriter.writeAttribute("class", "help-block"); tagWriter.appendValue(text); tagWriter.endTag(); tagWriter.forceBlock(); } }
From source file:com.benfante.taglib.frontend.tags.BootstrapTagHelper.java
/** * Writes the opening '//from ww w . jav a 2s. co m * <code>span</code>' tag and forces a block tag so that field prefix/suffix * is written correctly. */ public static void writeInputTagDecorator(final TagWriter tagWriter, final String text) throws JspException { if (StringUtils.hasText(text)) { tagWriter.startTag("span"); tagWriter.writeAttribute("class", "input-group-addon"); tagWriter.appendValue(text); tagWriter.endTag(); tagWriter.forceBlock(); } }
From source file:com.jigsforjava.web.tags.LinkTag.java
@Override protected int writeTagContents(TagWriter tagWriter) throws Exception { tagWriter.writeAttribute(HREF_ATTRIBUTE, toUrl()); tagWriter.writeOptionalAttributeValue(TARGET_ATTRIBUTE, getTarget()); return EVAL_BODY_INCLUDE; }
From source file:com.jigsforjava.web.tags.ImageTag.java
@Override protected int writeTagContents(TagWriter tagWriter) throws Exception { tagWriter.writeAttribute(SRC_ATTRIBUTE, getRequestContext().getContextPath() + getSrc()); tagWriter.writeOptionalAttributeValue(ALT_ATTRIBUTE, getAlt()); return SKIP_BODY; }
From source file:com.jigsforjava.web.tags.form.SubmitButtonTag.java
@Override protected int writeTagContents(TagWriter tagWriter) throws Exception { tagWriter.writeAttribute(TYPE_ATTRIBUTE, getType()); tagWriter.writeAttribute(VALUE_ATTRIBUTE, getValue()); tagWriter.writeAttribute(ONCLICK_ATTRIBUTE, createOnClick()); return SKIP_BODY; }
From source file:com.benfante.taglib.frontend.tags.LabelledOutputTag.java
@Override protected int writeTagContent(TagWriter tagWriter) throws JspException { tagWriter.startTag("div"); tagWriter.writeAttribute("class", "row"); writeLabelTagContent(tagWriter);/*from w ww . j a v a 2 s.c o m*/ tagWriter.startTag("output"); tagWriter.writeAttribute("class", this.getCssClass()); tagWriter.forceBlock(); this.tagWriter = tagWriter; return EVAL_BODY_INCLUDE; }
From source file:org.hdiv.web.servlet.tags.form.CheckboxTagHDIV.java
@Override protected void writeTagDetails(TagWriter tagWriter) throws JspException { tagWriter.writeAttribute("type", "checkbox"); Object boundValue = getBoundValue(); Class valueType = getBindStatus().getValueType(); if (Boolean.class.equals(valueType) || boolean.class.equals(valueType)) { // the concrete type may not be a Boolean - can be String if (boundValue instanceof String) { boundValue = Boolean.valueOf((String) boundValue); }/*from w w w . j ava 2 s. c om*/ Boolean booleanValue = (boundValue != null ? (Boolean) boundValue : Boolean.FALSE); dataComposer.compose(getName(), "true", true); renderFromBoolean(booleanValue, tagWriter); } else { Object value = getValue(); if (value == null) { throw new IllegalArgumentException( "Attribute 'value' is required when binding to non-boolean values"); } Object resolvedValue = (value instanceof String ? evaluate("value", (String) value) : value); dataComposer.compose(getName(), getDisplayString(resolvedValue), true); renderFromValue(resolvedValue, tagWriter); } }
From source file:com.jigsforjava.web.tags.form.FormTag.java
@Override protected int writeTagContents(TagWriter tagWriter) throws Exception { tagWriter.writeAttribute(ACTION_ATTRIBUTE, toUrl()); tagWriter.writeOptionalAttributeValue(METHOD_ATTRIBUTE, getMethod()); tagWriter.writeOptionalAttributeValue(TARGET_ATTRIBUTE, getTarget()); tagWriter.writeOptionalAttributeValue(ENCTYPE_ATTRIBUTE, getEnctype()); tagWriter.writeOptionalAttributeValue(ACCEPT_CHARSET_ATTRIBUTE, getAcceptCharset()); tagWriter.writeOptionalAttributeValue(ONSUBMIT_ATTRIBUTE, getOnsubmit()); tagWriter.writeOptionalAttributeValue(ONRESET_ATTRIBUTE, getOnreset()); tagWriter.writeOptionalAttributeValue(AUTOCOMPLETE_ATTRIBUTE, getAutocomplete()); return EVAL_BODY_INCLUDE; }
From source file:org.hdiv.web.servlet.tags.form.HiddenInputTagHDIV.java
/** * Writes the HTML '<code>input</code>' tag to the supplied * {@link TagWriter} including the databound value. * /*from ww w.j a va 2s . c o m*/ * @see #writeDefaultAttributes(TagWriter) * @see #getBoundValue() */ @Override protected int writeTagContent(TagWriter tagWriter) throws JspException { tagWriter.startTag("input"); writeDefaultAttributes(tagWriter); tagWriter.writeAttribute("type", "hidden"); String displayValue = getDisplayString(getBoundValue(), getPropertyEditor()); String displayName = getDisplayString(evaluate("name", getName())); IDataComposer dataComposer = (IDataComposer) this.pageContext.getRequest() .getAttribute(TagUtils.DATA_COMPOSER); String hdivValue = dataComposer.compose(displayName, displayValue, false); tagWriter.writeAttribute("value", hdivValue); tagWriter.endTag(); return SKIP_BODY; }
From source file:org.hdiv.web.servlet.tags.form.SubmitTagHDIV.java
/** * Writes the '<code>input</code>' tag to the supplied {@link TagWriter}. * Uses the value returned by {@link #getType()} to determine which * type of '<code>input</code>' element to render. *///from ww w.j av a2s . c o m @Override protected int writeTagContent(TagWriter tagWriter) throws JspException { tagWriter.startTag("input"); writeDefaultAttributes(tagWriter); tagWriter.writeAttribute("type", getType()); writeValue(tagWriter); tagWriter.endTag(); return EVAL_PAGE; }