Example usage for javax.servlet.jsp JspException JspException

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

Introduction

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

Prototype

public JspException(String message, Throwable cause) 

Source Link

Document

Constructs a new JspException with the specified detail message and cause.

Usage

From source file:edu.northwestern.bioinformatics.studycalendar.web.taglibs.jsgenerator.ElementUpdatingGenerator.java

protected void writeCall(String method, Object... parameters) throws JspException {
    String js = call(method, parameters);
    try {/*www .  ja v a 2s.  c  o  m*/
        pageContext.getOut().write(js);
    } catch (IOException e) {
        throw new JspException("Exception encountered when writing " + js, e);
    }
}

From source file:de.highbyte_le.weberknecht.request.taglibs.SiteBaseLinkTag.java

@Override
public int doStartTag() throws JspException {
    try {//w w  w. j  a v  a2  s  .co m
        pageContext.getOut().print(getBaseUrl());
        return SKIP_BODY;
    } catch (IOException e) {
        throw new JspException("i/o exception: " + e.getMessage(), e);
    }
}

From source file:com.google.code.trapo.web.tags.AbstractTrapoTag.java

@Override
public int doStartTag() throws JspException {
    try {/*from   ww  w.  j a va 2 s  . c om*/
        write(completeUrl());
        return BodyTag.SKIP_BODY;
    } catch (IOException ex) {
        throw new JspException(ex.getMessage(), ex);
    }
}

From source file:com.adito.core.tags.ExternalContentTag.java

public int doEndTag() throws JspException {
    InputStream in = null;/*from   www .  jav  a2  s .  c o  m*/
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    try {
        in = new URL(url).openStream();
        Util.copy(in, baos);
        TagUtils.getInstance().write(pageContext, new String(baos.toByteArray()));
    } catch (IOException ioe) {
        throw new JspException("Failed to load external page.", ioe);
    } finally {
        Util.closeStream(in);
        Util.closeStream(baos);
    }
    return (EVAL_PAGE);
}

From source file:com.agiletec.apsadmin.tags.HookPointTag.java

@Override
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
    ValueStack stack = this.getStack();
    try {//  w w  w .ja  va2  s  .  com
        List<HookPointElementContainer> containers = extractElements(request);
        if (containers.size() > 0) {
            stack.getContext().put(this.getObjectName(), containers);
            stack.setValue("#attr['" + this.getObjectName() + "']", containers, false);
            return EVAL_BODY_INCLUDE;
        }
    } catch (Throwable t) {
        throw new JspException("Error detected ", t);
    }
    return super.doStartTag();
}

From source file:net.sf.infrared.web.customtags.ColorThresholdTag.java

public int doStartTag() throws JspException {
    Object formBean = RequestUtils.lookup(pageContext, name, scope);

    String beanProperty = null;/*ww w  .j  av  a 2  s. c  o  m*/
    try {
        beanProperty = (String) PropertyUtils.getProperty(formBean, property);
    } catch (IllegalAccessException e) {
        throw new JspException("Unable to find the property " + property + " in the bean", e);
    } catch (InvocationTargetException e) {
        throw new JspException("Unable to find the property " + property + " in the bean", e);
    } catch (NoSuchMethodException e) {
        throw new JspException("Unable to find the property " + property + " in the bean", e);
    }
    double value = Double.parseDouble(beanProperty);

    if (value > COLOR_THRESHOLD)
        return (EVAL_BODY_INCLUDE);
    else
        return (SKIP_BODY);
}

From source file:com.bsb.cms.moss.commons.tag.IfAuthButtonTag.java

@Override
public int doEndTag() throws JspException {
    if (subTagSucceeded) {
        try {//from  ww  w.ja  v  a  2s  . c  o  m
            pageContext.getOut().write(getBody());
        } catch (IOException e) {
            throw new JspException(e.getMessage(), e);
        }
    }

    init();

    return super.doEndTag();
}

From source file:net.sourceforge.ajaxtags.tags.AjaxAnchorsTag.java

/**
 * Rewrite anchors in body content of the tag.
 *
 * @return rewritten and reformatted XHTML content
 * @throws JspException//from w w  w  . j  a v  a2  s.c om
 *             on errors
 */
public String processBody() throws JspException {
    final String content = getBody();
    try {
        return processContent(content);
    } catch (XPathExpressionException e) {
        throw new JspException(
                getClass().getSimpleName() + ": rewrite links failed (wrong XPath expression)\n" + content, e);
    } catch (TransformerException e) {
        throw new JspException(getClass().getSimpleName()
                + ": rewrite links failed (cannot transform XHTML to text)\n" + content, e);
    } catch (SAXException e) {
        throw new JspException(
                getClass().getSimpleName() + ": rewrite links failed (invalid XHTML content)\n" + content, e);
    }
}

From source file:com.agiletec.aps.tags.PageWithWidgetTag.java

@Override
public int doStartTag() throws JspException {
    IPageManager pageManager = (IPageManager) ApsWebApplicationUtils.getBean(SystemConstants.PAGE_MANAGER,
            this.pageContext);
    try {//from  ww w .j  a v a  2  s.  c om
        List<IPage> pages = pageManager.getWidgetUtilizers(this.getWidgetTypeCode());
        if (StringUtils.isNotBlank(this.getFilterParamName())
                && StringUtils.isNotBlank(this.getFilterParamValue())) {
            pages = this.filterByConfigParamValue(pages);
        }
        if (this.isListResult()) {
            this.pageContext.setAttribute(this.getVar(), pages);
        } else if (null != pages && pages.size() > 0) {
            this.pageContext.setAttribute(this.getVar(), pages.get(0));
        }
    } catch (Throwable t) {
        _logger.error("Error in doStartTag", t);
        //ApsSystemUtils.logThrowable(t, this, "doStartTag");
        throw new JspException("Error in doStartTag", t);
    }
    return super.doStartTag();
}

From source file:com.laxser.blitz.web.taglibs.FlashTag.java

@Override
public int doStartTag() throws JspException {
    Invocation invocation = InvocationUtils.getCurrentThreadInvocation();
    if (invocation != null) {
        String msg = invocation.getFlash().get(key);
        if (logger.isDebugEnabled()) {
            logger.debug("getFlashMessage: " + key + "=" + msg);
        }// w  w  w .ja v  a2  s.  c  o m
        if (msg != null) {
            try {
                if (StringUtils.isNotEmpty(prefix)) {
                    pageContext.getOut().print(prefix);
                }
                pageContext.getOut().print(msg);
                if (StringUtils.isNotEmpty(suffix)) {
                    pageContext.getOut().print(suffix);
                }
            } catch (IOException e) {
                throw new JspException("", e);
            }
        }
    }
    return super.doStartTag();
}