Example usage for javax.servlet.jsp.tagext BodyContent getString

List of usage examples for javax.servlet.jsp.tagext BodyContent getString

Introduction

In this page you can find the example usage for javax.servlet.jsp.tagext BodyContent getString.

Prototype

public abstract String getString();

Source Link

Document

Return the value of the BodyContent as a String.

Usage

From source file:com.steeleforge.aem.ironsites.wcm.taglib.SetModeTag.java

@Override
public int doAfterBody() throws JspException {
    BodyContent bc = getBodyContent();
    try {//  w  w  w  .  j a  v a  2  s .c o m
        bc.getEnclosingWriter().print(bc.getString());
    } catch (IOException ioe) {
        LOG.debug(ioe.getMessage());
        throw new JspException(ioe);
    } finally {
        bc = null;
    }
    return SKIP_BODY;
}

From source file:com.wabacus.system.tags.DataImportTag.java

public int doEndTag() throws JspException {
    if (ref == null || ref.trim().equals("")) {
        throw new JspException("<wx:dataimport/>ref");
    }//w  w w.  j  a v  a2 s. c  om
    BodyContent bc = getBodyContent();
    String label = null;
    if (bc != null)
        label = bc.getString();
    JspWriter out = pageContext.getOut();
    try {
        out.println(TagAssistant.getInstance().getDataImportDisplayValue(ref, this.asyn, this.popupparams,
                this.dataimportinitsize, label, this.interceptor,
                (HttpServletRequest) pageContext.getRequest()));
    } catch (IOException e) {
        log.error("??", e);
    }
    return EVAL_PAGE;
}

From source file:jp.co.golorp.emarf.tag.lib.BodyTagSupport.java

@Override
public int doAfterBody() throws JspException {

    // bodyContent???
    BodyContent bodyContent = this.bodyContent;
    if (bodyContent != null) {
        String text = bodyContent.getString();
        if (StringUtils.isNotBlank(text)) {
            try {
                bodyContent.getEnclosingWriter().print(text);
            } catch (IOException e) {
                throw new JspException(e);
            } finally {
                bodyContent.clearBody();
            }/*  w  w  w . j av  a2 s .co m*/

            // bodyContent??
            this.isPrintBody = true;
        }
    }

    return SKIP_BODY;
}

From source file:com.wabacus.system.tags.FileUploadTag.java

public int doEndTag() throws JspException {
    BodyContent bc = getBodyContent();
    String label = null;// w  w  w .  j  a v a  2 s .co  m
    if (bc != null)
        label = bc.getString();
    JspWriter out = pageContext.getOut();
    try {
        out.println(TagAssistant.getInstance().getFileUploadDisplayValue(maxsize, allowtypes, disallowtypes,
                uploadcount, newfilename, savepath, rooturl, popupparams, this.initsize, this.interceptor,
                label, this.beforepopup, (HttpServletRequest) pageContext.getRequest()));
    } catch (IOException e) {
        log.error("", e);
    }
    return EVAL_PAGE;
}

From source file:com.wabacus.system.tags.component.ButtonTag.java

public int doMyEndTag() throws JspException, IOException {
    BodyContent bc = getBodyContent();
    String button = null;/* w w  w.ja  v a  2  s  .com*/
    if (bc != null)
        button = bc.getString();
    button = button == null ? "" : button.trim();
    Map<String, String> attributes = new HashMap<String, String>();
    attributes.put("type", type);
    attributes.put("name", name);
    attributes.put("savebinding", savebinding);
    attributes.put("deletebinding", deletebinding);
    attributes.put("label", button);
    attributes.put("componentids", this.dataexportcomponentids);
    attributes.put("pageurl", pageurl);
    attributes.put("beforecallback", beforecallback);
    attributes.put("directorydateformat", this.directorydateformat);
    attributes.put("download", this.download);
    attributes.put("autodelete", this.autodelete);
    attributes.put("localstroage", this.localstroage);
    attributes.put("zip", this.zip);
    if (Consts.lstDataExportTypes.contains(type)) {//???displayReportObjreportid?id???????displayReportObj
        println(TagAssistant.getInstance().getButtonDisplayValue(this.ownerComponentObj, attributes));
    } else {
        if (this.displayComponentObj == null)
            return EVAL_PAGE;
        println(TagAssistant.getInstance().getButtonDisplayValue(this.displayComponentObj, attributes));
    }
    return EVAL_PAGE;
}

From source file:net.mlw.vlh.web.tag.DefaultColumnCheckBoxTag.java

/**
 * @see javax.servlet.jsp.tagext.Tag#doEndTag()
 *//*from   ww  w.  java 2  s  . c  o m*/
public int doEndTag() throws JspException {

    ValueListSpaceTag rootTag = (ValueListSpaceTag) JspUtils.getParent(this, ValueListSpaceTag.class);
    ValueListConfigBean config = rootTag.getConfig();

    DefaultRowTag rowTag = (DefaultRowTag) JspUtils.getParent(this, DefaultRowTag.class);
    appendClassCellAttribute(rowTag.getRowStyleClass());

    Locale locale = config.getLocaleResolver().resolveLocale((HttpServletRequest) pageContext.getRequest());

    if (rowTag.getCurrentRowNumber() == 0) {
        String titleKey = getTitleKey();
        String label = (titleKey == null) ? getTitle()
                : config.getMessageSource().getMessage(titleKey, null, titleKey, locale);

        StringBuffer header = new StringBuffer(512);
        if (label != null) {
            header.append(label);
        }

        header.append(
                "<input type=\"checkbox\" onclick=\"for(i=0; i < this.form.elements.length; i++) {if (this.form.elements[i].name=='")
                .append(getName()).append("') {this.form.elements[i].checked = this.checked;}}\"/>");

        ColumnInfo columnInfo = new ColumnInfo(config.getDisplayHelper().help(pageContext, header.toString()),
                property, null, getAttributes());

        // Process toolTip if any
        // toolTip or toolTipKey is set => get the string and put it into the ColumnInfo
        String toolTipKey = getToolTipKey();
        columnInfo.setToolTip((toolTipKey == null) ? getToolTip()
                : config.getMessageSource().getMessage(toolTipKey, null, toolTipKey, locale));

        rowTag.addColumnInfo(columnInfo);
    }

    Object bean = pageContext.getAttribute(rowTag.getBeanName());
    Object value = "na";

    try {
        value = PropertyUtils.getProperty(bean, property);
    } catch (Exception e) {
    }

    StringBuffer sb = new StringBuffer();

    sb.append(rowTag.getDisplayProvider().getCellPreProcess(getCellAttributes()));

    BodyContent bodyContent = getBodyContent();
    if (bodyContent != null && bodyContent.getString() != null && bodyContent.getString().length() > 0) {
        sb.append(bodyContent.getString());
        bodyContent.clearBody();
    } else {
        sb.append("<input type=\"checkbox\" name=\"").append(name).append("\" value=\"").append(value)
                .append("\"/>");
    }

    sb.append(rowTag.getDisplayProvider().getCellPostProcess());
    JspUtils.write(pageContext, sb.toString());

    release();

    return EVAL_PAGE;
}

From source file:net.naijatek.myalumni.util.taglib.BuildImageTag.java

@Override
public int doAfterBody() throws JspException, JspTagException {
    BodyContent bc = getBodyContent();
    setImageUrl(bc.getString()); // get body string
    bc.clearBody(); // clean up
    return SKIP_BODY;
}

From source file:com.googlecode.psiprobe.jsp.VisualScoreTag.java

public int doAfterBody() throws JspException {
    BodyContent bc = getBodyContent();
    String body = bc.getString().trim();

    StringBuffer buf = calculateSuffix(body);

    try {/*  ww  w . j  av a2  s.c  o m*/
        JspWriter out = bc.getEnclosingWriter();
        out.print(buf.toString());
    } catch (IOException ioe) {
        throw new JspException("Error:IOException while writing to client" + ioe.getMessage());
    }

    return SKIP_BODY;
}

From source file:gov.nih.nci.calims2.taglib.form.ButtonTag.java

private void addBody(Tag tag) {
    BodyContent content = getBodyContent();
    if (content != null) {
        ContentTag contentTag = tag.addChild(new ContentTag(content.getString()));
        contentTag.setContentType(ContentType.TEXT);
    }// w  w w.  j  a  v  a2s . c  om
}

From source file:gov.nih.nci.calims2.taglib.form.FormTag.java

private void addBody(Tag tag) {
    BodyContent content = getBodyContent();
    if (content != null) {
        ContentTag contentTag = tag.addChild(new ContentTag(content.getString()));
        contentTag.setContentType(ContentType.TEXT);
    }//  w ww  . jav a 2  s .co m
    if (validate) {
        Tag scriptTag = tag.addChild(new CompositeTag(HtmlElement.SCRIPT));
        scriptTag.addAttribute("args", "evt");
        scriptTag.addAttribute("event", "onSubmit");
        scriptTag.addAttribute("type", "dojo/method");
        ContentTag contentTag = scriptTag.addChild(new ContentTag(ON_SUBMIT_SCRIPT));
        contentTag.setContentType(ContentType.TEXT);
    }
}