Example usage for javax.servlet.jsp JspTagException JspTagException

List of usage examples for javax.servlet.jsp JspTagException JspTagException

Introduction

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

Prototype


public JspTagException(Throwable rootCause) 

Source Link

Document

Constructs a new JSP Tag exception when the JSP Tag needs to throw an exception and include a message about the "root cause" exception that interfered with its normal operation.

Usage

From source file:au.org.ala.commonui.headertails.MenuTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
 *///from   w  w w  . ja  v a  2  s. c  o m
public int doStartTag() throws JspException {
    try {
        HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

        HeaderAndTailUtil hatu = new HeaderAndTailUtil(pageContext);
        String html = hatu.getMenu();
        pageContext.getOut().print(html);
    } catch (Exception e) {
        logger.error("BannerMenuTag: " + e.getMessage(), e);
        throw new JspTagException("BannerMenuTag: " + e.getMessage());
    }

    return super.doStartTag();
}

From source file:org.rhq.enterprise.gui.legacy.taglib.display.SelectDecorator.java

/**
 * don't skip the body/*from   ww  w . j a  v  a  2s  . c  o  m*/
 */
public int doStartTag() throws JspTagException {
    Object parent = getParent();

    if ((parent == null) || !(parent instanceof ColumnTag)) {
        throw new JspTagException("A BaseDecorator must be used within a ColumnTag.");
    }

    ((ColumnTag) parent).setDecorator(this);

    return SKIP_BODY;
}

From source file:com.rsmart.certification.tool.tag.AbstractLocalizableTag.java

/**
 * Resolve the specified message into a concrete message String.
 * The returned message String should be unescaped.
 * @param message//w ww.  j a v  a2  s.c o  m
 * @param args
 * @return
 * @throws javax.servlet.jsp.JspException
 */
protected String resolveMessage(String message, Object[] args) throws JspException, NoSuchMessageException {
    MessageSource messageSource = getMessageSource();
    if (messageSource == null) {
        throw new JspTagException("No corresponding MessageSource found");
    }

    return messageSource.getMessage(message, args, "??" + message + "??", getRequestContext().getLocale());
}

From source file:com.citytechinc.cq.clientlibs.core.tags.PageLibraryTag.java

@Override
public int doEndTag() throws JspTagException {

    final SlingHttpServletRequest request = (SlingHttpServletRequest) pageContext
            .getAttribute(ATTR_SLING_REQUEST);

    try {/* w  ww  .ja  va2 s .c o m*/
        if (buildJs()) {

            pageContext.getOut().write(buildJsIncludeString(request));

        }
        if (buildCss()) {

            pageContext.getOut().write(buildCssIncludeString(request));

        }
    } catch (IOException e) {
        LOG.error("error writing page library tag", e);
        throw new JspTagException(e);
    }

    return EVAL_PAGE;

}

From source file:org.hyperic.hq.ui.taglib.display.SelectDecorator.java

/**
 * don't skip the body/*from  ww  w.  j a v a  2 s .c om*/
 */
public int doStartTag() throws JspTagException {
    Object parent = getParent();

    if (parent == null || !(parent instanceof ColumnTag)) {
        throw new JspTagException("A BaseDecorator must be used within a ColumnTag.");
    }

    ((ColumnTag) parent).setDecorator(this);

    return SKIP_BODY;
}

From source file:org.hyperic.hq.ui.taglib.ShortenTextTag.java

public int doStartTag() throws JspException {
    try {//from  w w w  .j a  v  a2  s. c o  m
        String value = getValue();

        shorten = value.length() > maxlength;

        if (property != null) {
            pageContext.setAttribute(property, value);
        }
    } catch (NullPointerException npe) {
        throw new JspTagException(npe);
    }

    return SKIP_BODY;
}

From source file:no.kantega.publishing.api.taglibs.util.GetOrgUnitTag.java

@SuppressWarnings("unchecked")
public int doStartTag() throws JspException {
    if (isBlank(orgUnitId)) {
        return SKIP_BODY;
    }/*from  w  w  w.java  2 s  . com*/

    try {
        for (OrganizationManager organizationManager : organizationManagers) {
            OrgUnit orgUnit = organizationManager.getUnitByExternalId(orgUnitId);
            if (orgUnit != null) {
                ServletRequest request = pageContext.getRequest();
                request.setAttribute(name, orgUnit);
                break;
            }
        }

    } catch (Exception e) {
        log.error("", e);
        throw new JspTagException(e);
    }

    return SKIP_BODY;
}

From source file:org.rhq.enterprise.gui.legacy.taglib.display.BaseDecorator.java

public int doStartTag() throws JspTagException {
    Object parent = getParent();//from ww w .j a v a 2s. com

    if ((parent == null) || !(parent instanceof ColumnTag)) {
        throw new JspTagException("A BaseDecorator must be used within a ColumnTag.");
    }

    ((ColumnTag) parent).setDecorator(this);

    return SKIP_BODY;
}

From source file:org.openmrs.module.mdrtb.web.taglib.MdrtbConceptTag.java

/**
 * @see Tag#doEndTag()// w  w  w . j  a  v  a  2 s  .c  o m
 */
public int doEndTag() throws JspException {
    try {
        if (getBodyContent() != null) {
            getBodyContent().writeOut(getBodyContent().getEnclosingWriter());
        }
    } catch (java.io.IOException e) {
        throw new JspTagException("IO Error: " + e.getMessage());
    }
    return EVAL_PAGE;
}

From source file:org.openmrs.notification.web.ForEachAlertTag.java

@Override
protected Object next() throws JspTagException {
    if (alerts == null) {
        throw new JspTagException("The alert iterator is null");
    }/*from  w w  w.  j av a 2 s.  c o  m*/
    return alerts.next();
}