Example usage for javax.servlet.jsp JspWriter write

List of usage examples for javax.servlet.jsp JspWriter write

Introduction

In this page you can find the example usage for javax.servlet.jsp JspWriter write.

Prototype

public void write(int c) throws IOException 

Source Link

Document

Writes a single character.

Usage

From source file:org.wso2.carbon.ui.taglibs.TooltipsGenerator.java

/**
 * This method is invoked when the custom end tag is encountered.
 * The main function of this method is to add a image and display a tooltips when mouse over
 * that image. This is done by calling the 'showTooltips' method in ../admin/js/widgets.js
 * java script file.//  w ww.j av  a 2  s. c o m
 * @return return EVAL_PAGE - continue processing the page.
 * @throws JspException
 */
public int doEndTag() throws JspException {
    JspWriter writer = pageContext.getOut();
    String context = "<link rel='stylesheet' type='text/css' "
            + "href='../yui/build/container/assets/skins/sam/container.css'>\n"
            + "<script type=\"text/javascript\" "
            + "src=\"../yui/build/yahoo-dom-event/yahoo-dom-event.js\"></script>\n"
            + "<script type=\"text/javascript\" "
            + "src=\"../yui/build/container/container-min.js\"></script>\n"
            + "<script type=\"text/javascript\" " + "src=\"../yui/build/element/element-min.js\"></script>\n"
            + "<script type=\"text/javascript\" src=\"../admin/js/widgets.js\"></script>\n";

    if ((getResourceBundle() != null && getKey() != null)
            || (getResourceBundle() == null && getKey() != null)) { //create tooltips content from resource bundle.
        context = context + "<a target='_blank' class='icon-link' " + "onmouseover=\"showTooltip(this,'"
                + getTooltipsContentFromKey() + "')\" " + "style='background-image:url(\"" + getImage()
                + "\")' ></a>";
    } else if (this.description != null) { //create the tooltips content from user given text.
        context = context + "<a target='_blank' class='icon-link' " + "onmouseover=\"showTooltip(this,'"
                + createTooltipsBody(getNoOfWordsPerLine()) + "')\" " + "style='background-image:url(\""
                + getImage() + "\")' ></a>";
    }

    try {
        writer.write(context);
    } catch (IOException e) {
        String msg = "Cannot write tag content";
        throw new JspException(msg, e);
    }
    return EVAL_PAGE;
}

From source file:ru.runa.common.web.tag.VisibleTag.java

@Override
public int doStartTag() {
    JspWriter writer = null;
    try {// w ww. j a v  a 2s. co  m
        isVisible = isVisible();
        if (isVisible) {
            writer = pageContext.getOut();
            ConcreteElement element = getStartElement();
            element.output(writer);
        }
    } catch (Throwable th) {
        // DEBUG category set due to logging in EJB layer; stack trace
        // is logged only for Web layer errors.
        log.debug("", th);
        try {
            if (writer != null) {
                writer.write("<span class=\"error\">" + ActionExceptionHelper.getErrorMessage(th, pageContext)
                        + "</span>");
            }
        } catch (IOException e1) {
            // Do nothing.
        }
    }
    return doStartTagReturnedValue();
}

From source file:ru.runa.common.web.tag.VisibleTag.java

@Override
public int doEndTag() {
    if (isVisible) {
        JspWriter writer = pageContext.getOut();
        try {/*from   w  ww  . j  a  va 2s  .c  o m*/
            ConcreteElement element = getEndElement();
            element.output(writer);
        } catch (Throwable th) {
            // DEBUG category set due to logging in EJB layer; stack trace
            // is logged only for Web layer errors.
            log.debug("", th);
            try {
                writer.write("<span class=\"error\">" + ActionExceptionHelper.getErrorMessage(th, pageContext)
                        + "</span>");
            } catch (IOException e) {
                // Do nothing.
            }
        }
    }
    return doEndTagReturnedValue();
}