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(Throwable cause) 

Source Link

Document

Constructs a new JspException with the specified cause.

Usage

From source file:net.ymate.framework.core.taglib.ui.CssTag.java

@Override
public int doAfterBody() throws JspException {
    try {/* w w  w. j av  a 2  s. co m*/
        if (this.bodyContent != null) {
            this.bodyContent.clearBody();
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    return super.doAfterBody();
}

From source file:net.ymate.framework.core.taglib.ui.LayoutTag.java

@Override
public int doStartTag() throws JspException {
    __ui = (BaseUITag) this.getParent();
    if (__ui == null) {
        throw new JspException("Parent UITag or LayoutTag not found.");
    }//from w  w  w  . j  a  v  a  2s  . c  om
    try {
        if (StringUtils.isNotBlank(this.getSrc())) {
            __tmplContent = WebUtils.includeJSP((HttpServletRequest) this.pageContext.getRequest(),
                    (HttpServletResponse) this.pageContext.getResponse(), this.buildSrcUrl(),
                    __ui.getCharsetEncoding());
        } else {
            __tmplContent = "";
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    return super.doStartTag();
}

From source file:net.ymate.framework.core.taglib.ui.LayoutTag.java

@Override
public int doAfterBody() throws JspException {
    try {/*from  ww w . j  a  va2  s .c om*/
        if (this.bodyContent != null) {
            String _layoutBody = StringUtils.defaultIfEmpty(this.bodyContent.getString(), "");
            if (StringUtils.isNotBlank(__tmplContent)) {
                this.writerToBodyPart(_layoutBody);
            } else {
                __tmplContent = _layoutBody;
            }
            this.bodyContent.clearBody();
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    return super.doAfterBody();
}

From source file:net.ymate.framework.core.taglib.ui.LayoutTag.java

@Override
public int doEndTag() throws JspException {
    try {/*from w  w w .  j av  a 2  s  .  c o  m*/
        __ui.writerToMetaPart(this.getMetaPartContent());
        __ui.writerToCssPart(this.getCssPartContent());
        __ui.writerToScriptPart(this.getScriptPartContent());
        __tmplContent = this.mergeContent(StringUtils.defaultIfEmpty(__tmplContent, ""));
        //
        if (StringUtils.isNotBlank(name) && !"body".equalsIgnoreCase(name)) {
            __ui.putProperty(name, !isCleanup() ? __tmplContent : WebUtils.replaceRegClear(__tmplContent));
        } else {
            __ui.writerToBodyPart(!isCleanup() ? __tmplContent : WebUtils.replaceRegClear(__tmplContent));
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    //
    this.__ui = null;
    this.__tmplContent = null;
    this.name = null;
    return super.doEndTag();
}

From source file:net.ymate.framework.core.taglib.ui.MetaTag.java

@Override
public int doAfterBody() throws JspException {
    try {//from  w w w.j a  v a2  s.  c o  m
        if (this.bodyContent != null) {
            String _propValue = this.bodyContent.getString();
            if (StringUtils.isNotBlank(_propValue)) {
                this.setAttrValue(_propValue);
            }
            this.bodyContent.clearBody();
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    return super.doAfterBody();
}

From source file:net.ymate.framework.core.taglib.ui.PropertyTag.java

@Override
public int doAfterBody() throws JspException {
    try {//www  . ja va2  s  . co m
        if (this.bodyContent != null) {
            String _propValue = this.bodyContent.getString();
            if (StringUtils.isNotBlank(_propValue)) {
                this.setValue(_propValue);
            }
            this.bodyContent.clearBody();
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    return super.doAfterBody();
}

From source file:net.ymate.framework.core.taglib.ui.UITag.java

@Override
public int doStartTag() throws JspException {
    try {/*w  w  w  . java  2 s.co  m*/
        if (currentUI() == null) {
            __isCurrentUI = true;
            this.pageContext.setAttribute(UITag.class.getName(), this);
        }
    } catch (Exception e) {
        throw new JspException(RuntimeUtils.unwrapThrow(e));
    }
    return super.doStartTag();
}

From source file:net.ymate.framework.core.taglib.ui.UITag.java

@Override
public int doEndTag() throws JspException {
    if (__isCurrentUI) {
        try {//from  w w w . j  a  va  2  s . c  om
            /* UI? */
            String __tmplContent = null;
            if (StringUtils.isNotBlank(this.getSrc())) {
                __tmplContent = WebUtils.includeJSP((HttpServletRequest) this.pageContext.getRequest(),
                        (HttpServletResponse) this.pageContext.getResponse(), this.buildSrcUrl(),
                        this.getCharsetEncoding());
            }
            __tmplContent = this.mergeContent(StringUtils.defaultIfEmpty(__tmplContent, "@{body}"));
            this.pageContext.getOut()
                    .write(!isCleanup() ? __tmplContent : WebUtils.replaceRegClear(__tmplContent));
        } catch (Exception e) {
            throw new JspException(RuntimeUtils.unwrapThrow(e));
        }
    }
    this.__isCurrentUI = false;
    return super.doEndTag();
}

From source file:nl.b3p.commons.taglib.ImgBeanTag.java

/**
 * Render the end of the IMG tag./* w w  w .  j av  a 2  s .  com*/
 *
 * @exception JspException if a JSP exception has occurred
 */
public int doEndTag() throws JspException {
    // Calculate page from bean, if present and no page attribute
    if (blink != null && bpage != null) {
        // Retrieve the required property
        try {
            Object bean = pageContext.findAttribute(blink);
            page = (String) PropertyUtils.getProperty(bean, bpage);
            if (page == null) {
                return (EVAL_PAGE);
            }
        } catch (IllegalAccessException e) {
            throw new JspException("No access: " + e.getMessage());
        } catch (InvocationTargetException e) {
            Throwable t = e.getTargetException();
            throw new JspException("No result: " + e.getMessage());
        } catch (NoSuchMethodException e) {
            throw new JspException("No method: " + e.getMessage());
        } catch (Exception e) {
        }
    }

    // Evaluate the remainder of this page
    return super.doEndTag();

}

From source file:nl.b3p.commons.taglib.LinkBeanTag.java

/**
 * Render the beginning of the bean hyperlink.
 *
 * @exception JspException if a JSP exception has occurred
 *///  w ww. ja  va2 s .co m
public int doStartTag() throws JspException {

    // Calculate page from bean, if present and no page attribute
    if (blink != null && bpage != null) {
        // Retrieve the required property
        try {
            Object bean = pageContext.findAttribute(blink);
            page = (String) PropertyUtils.getProperty(bean, bpage);
            if (page == null) {
                return (SKIP_BODY);
            }
        } catch (IllegalAccessException e) {
            throw new JspException("No access: " + e.getMessage());
        } catch (InvocationTargetException e) {
            Throwable t = e.getTargetException();
            throw new JspException("No result: " + e.getMessage());
        } catch (NoSuchMethodException e) {
            throw new JspException("No method: " + e.getMessage());
        } catch (Exception e) {
        }
    }

    return super.doStartTag();
}