Example usage for org.springframework.web.servlet.tags.form TagWriter endTag

List of usage examples for org.springframework.web.servlet.tags.form TagWriter endTag

Introduction

In this page you can find the example usage for org.springframework.web.servlet.tags.form TagWriter endTag.

Prototype

public void endTag() throws JspException 

Source Link

Document

Close the current tag.

Usage

From source file:com.benfante.taglib.frontend.tags.BootstrapTagHelper.java

/**
 * Writes the opening '//from  w  ww .  j  av  a  2s.com
 * <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 '// w  w  w.  ja  v  a2s. c  o  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: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.
 *///  ww w.  j  a v a 2s  .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;
}

From source file:com.benfante.taglib.frontend.tags.LabelledOutputTag.java

/**
 * Writes the opening '<code>label</code>' tag and forces a block tag so
 * that body content is written correctly.
 *///  w ww.  jav  a2 s  . c om
protected void writeLabelTagContent(TagWriter tagWriter) throws JspException {
    String labelText = this.getRequestContext().getMessage(this.label, this.label);
    tagWriter.startTag("label");
    tagWriter.writeAttribute("class", this.getLabelCssClass() + " font-weight-bold");
    tagWriter.appendValue(labelText);
    tagWriter.endTag();
}

From source file:com.benfante.taglib.frontend.tags.PasswordInputTag.java

/**
 * Writes the opening '<code>label</code>' tag and forces a block tag so
 * that body content is written correctly.
 *///from w w  w  .  j  a  v a2  s  .c  o  m
protected void writeLabelTagContent(TagWriter tagWriter) throws JspException {
    String labelText = this.getRequestContext().getMessage(this.label, this.label);
    tagWriter.startTag("label");
    tagWriter.writeAttribute("for", autogenerateFor());
    tagWriter.writeAttribute("class", "control-label");
    tagWriter.appendValue(labelText);
    tagWriter.endTag();
    tagWriter.forceBlock();
}

From source file:com.xyxy.platform.modules.core.web.taglib.BSCheckboxesTag.java

@Override
protected int writeTagContent(TagWriter tagWriter) throws JspException {
    super.writeTagContent(tagWriter);

    if (!isDisabled()) {
        // Write out the 'field was present' marker.
        tagWriter.startTag("input");
        tagWriter.writeAttribute("type", "hidden");
        String name = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + getName();
        tagWriter.writeAttribute("name", name);
        tagWriter.writeAttribute("value", processFieldValue(name, "on", getInputType()));
        tagWriter.endTag();
    }/*www  . j  ava  2  s .  c  o m*/

    return SKIP_BODY;
}

From source file:com.jigsforjava.web.tags.form.TextAreaTag.java

/**
  * @param tagWriter//from  www  .j a v  a 2  s . com
  */
private void writeMaxLengthScript(TagWriter writer) throws JspException {
    String elementId = createPath();
    writer.startTag("script");
    writeOptionalAttribute(writer, "type", "text/javascript");
    writer.appendValue("var element = ");
    writer.appendValue(asElement(elementId));
    writer.appendValue(";");
    writer.appendValue("element.onchange=");
    writeLengthLimitScript(writer);

    writer.appendValue("element.onkeyup=");
    writeLengthLimitScript(writer);
    writer.endTag();
}

From source file:org.kmnet.com.fw.web.pagination.PaginationTag.java

/**
 * Renders end tag.<br>/*from ww  w .ja va2s  .c o  m*/
 * @param tagWriter {@code TagWriter} instance that will render the content of the tag to JSP page
 * @throws JspException
 */
protected void endOuterElement(TagWriter tagWriter) throws JspException {
    if (StringUtils.hasText(outerElement)) {
        tagWriter.endTag(); // ul
    }
}

From source file:org.kmnet.com.fw.web.token.transaction.TransactionTokenTag.java

/**
 * Renders the transaction token string in a hidden tag with {@code name} and {@code value} attributes <br>
 * The value of {@code name} attribute is {@code _TRANSACTION_TOKEN}. {@code value} attribute is the transaction token
 * string <br>/*  w  w w  . j  a v a 2  s .  c  om*/
 * @see org.springframework.web.servlet.tags.form.AbstractFormTag#writeTagContent(org.springframework.web.servlet.tags.form.TagWriter)
 */
@Override
protected int writeTagContent(final TagWriter tagWriter) throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    TransactionToken nextToken = (TransactionToken) request
            .getAttribute(TransactionTokenInterceptor.NEXT_TOKEN_REQUEST_ATTRIBUTE_NAME);

    if (nextToken != null) {
        tagWriter.startTag("input");
        tagWriter.writeAttribute("type", "hidden");
        tagWriter.writeAttribute("name", TransactionTokenInterceptor.TOKEN_REQUEST_PARAMETER);
        tagWriter.writeAttribute("value", nextToken.getTokenString());
        tagWriter.endTag();
    }
    return SKIP_BODY;
}

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  www .java  2 s  . 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;
}