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.sf.ginp.tags.NavNextPic.java

/**
 *  Called when a Start tag is processed.
 *
 *@return                   Description of the Return Value
 *@exception  JspException  Description of the Exception
 *///from ww w. ja v  a2 s  . c om
public final int doStartTag() throws JspException {
    try {
        model = ModelUtil.getModel((HttpServletRequest) pageContext.getRequest());
    } catch (Exception e) {
        log.error(e);
        throw new JspException(e);
    }

    String picName = ((HttpServletRequest) pageContext.getRequest()).getParameter("name");

    if (model.getCollection().getNextPictureName(picName) != null) {
        pageContext.setAttribute("link",
                "ginpservlet?cmd=showpicture&colid=" + model.getCurrCollectionId() + "&path="
                        + model.getCollection().getPath() + "&name="
                        + model.getCollection().getNextPictureName(picName));

        return EVAL_BODY_AGAIN;
    } else {
        return SKIP_BODY;
    }
}

From source file:net.sf.ginp.tags.NavPrevPic.java

/**
 *  Called when a Start tag is processed.
 *
 *@return                   Description of the Return Value
 *@exception  JspException  Description of the Exception
 *//*from ww  w  .  j  a v a 2s. co m*/
public final int doStartTag() throws JspException {
    try {
        model = ModelUtil.getModel((HttpServletRequest) pageContext.getRequest());
    } catch (Exception e) {
        log.error(e);
        throw new JspException(e);
    }

    String picName = ((HttpServletRequest) pageContext.getRequest()).getParameter("name");

    if (model.getCollection().getPrevPictureName(picName) != null) {
        pageContext.setAttribute("link",
                "ginpservlet?cmd=showpicture&colid=" + model.getCurrCollectionId() + "&path="
                        + model.getCollection().getPath() + "&name="
                        + model.getCollection().getPrevPictureName(picName));

        return EVAL_BODY_AGAIN;
    } else {
        return SKIP_BODY;
    }
}

From source file:com.redhat.rhn.frontend.taglibs.RequiredFieldTag.java

/**
 * {@inheritDoc}/* w  w w  . ja va 2 s.c  o m*/
 */
@Override
public int doStartTag() throws JspException {
    // <bean:message key="cobbler.snippet.name"/>
    // <span class="required-form-field">*</span>
    LocalizationService ls = LocalizationService.getInstance();
    JspWriter writer = pageContext.getOut();
    try {
        if (!StringUtils.isBlank(key)) {
            String msg = ls.getMessage(key);
            if (msg.endsWith(":")) {
                msg = msg.substring(0, msg.length() - 1);
            }
            writer.write(msg);
        }
        return EVAL_BODY_INCLUDE;
    } catch (IOException e) {
        throw new JspException(e);
    }

}

From source file:com.redhat.rhn.frontend.configuration.tags.ConfigChannelTag.java

/**
 * {@inheritDoc}/*from   w  ww  .  j a  va2 s . co m*/
 */
public int doEndTag() throws JspException {
    StringBuilder result = new StringBuilder();
    if (nolink || id == null) {
        result.append(writeIcon());
        result.append(name);
    } else {
        result.append("<a href=\"" + ConfigChannelTag.makeConfigChannelUrl(id) + "\">");
        result.append(writeIcon());
        result.append(StringEscapeUtils.escapeXml(name) + "</a>");
    }
    JspWriter writer = pageContext.getOut();
    try {
        writer.write(result.toString());
    } catch (IOException e) {
        throw new JspException(e);
    }
    return BodyTagSupport.SKIP_BODY;
}

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:net.sf.ginp.tags.ConfigSettings.java

/**
 *  Called when a Start tag is processed.
 *
 *@return                   Description of the Return Value
 *@exception  JspException  Description of the Exception
 *///from  w w  w  . j a  v a2s . com
public final int doStartTag() throws JspException {
    try {
        model = ModelUtil.getModel((HttpServletRequest) pageContext.getRequest());
    } catch (Exception ex) {
        log.error("Error retriveing model", ex);
        throw new JspException(ex);
    }

    try {
        // if no config make user admin
        if (!Configuration.configOK()) {
            model.setUserName("admin");
        }

        // admin user only
        if (!model.getUserName().equals("admin")) {
            pageContext.getOut().write("admin only <a href=\"logon.jsp\">Logon</a>");

            return SKIP_BODY;
        }

        pageContext.setAttribute("adminpassword", "");
        pageContext.setAttribute("adminpasswordrepeat", "");

        pageContext.setAttribute("thumbsize", "" + Configuration.getThumbSize());
        pageContext.setAttribute("filmstripthumbsize", "" + Configuration.getFilmStripThumbSize());
        pageContext.setAttribute("picturepagename", Configuration.getPicturePageName());
        pageContext.setAttribute("collectionpagename", Configuration.getCollectionPageName());
        pageContext.setAttribute("forcelocale", Configuration.getForcelocale());
        pageContext.setAttribute("characterencoding", Configuration.getCharacterEncoding());
        pageContext.setAttribute("configfilelocation", Configuration.getConfigfilelocation());
    } catch (Exception ex) {
        log.error("Error seting attributes", ex);

        return SKIP_BODY;
    }

    return EVAL_BODY_AGAIN;
}

From source file:gov.nih.nci.cabig.caaers.web.tags.RenderDecisionManagerTag.java

private boolean validateParameters() throws JspException {
    if (StringUtils.isEmpty(elementID))
        throw new JspException("The elementID property cannot be empty");

    if (!(StringUtils.equalsIgnoreCase(UI_TYPE_DIVISION, uiType)
            || StringUtils.equalsIgnoreCase(UI_TYPE_FIELD, uiType))) {
        throw new JspException(String.format("Unknown value for uiType attribute allowed entries are - %s, %s",
                UI_TYPE_DIVISION, UI_TYPE_FIELD));
    }/*from  w w w  .ja  v  a2 s  . c  om*/
    return true;
}

From source file:com.jaspersoft.jasperserver.war.tags.BaseTagSupport.java

protected void includeNested(String path) throws JspException {
    BodyContent nestedContent = pageContext.pushBody();
    boolean popped = false;
    try {/*from   www  . j a v a2  s . com*/
        pageContext.include(path);

        popped = true;
        pageContext.popBody();
        nestedContent.writeOut(pageContext.getOut());
    } catch (ServletException e) {
        log.error(e, e);
        throw new JspException(e);
    } catch (IOException e) {
        log.error(e, e);
        throw new JspException(e);
    } finally {
        if (!popped) {
            pageContext.popBody();
        }
    }
}

From source file:com.googlecode.jtiger.modules.ecside.tag.ExtendTag.java

public int doAfterBody() throws JspException {
    try {/*www .j ava  2s.  c  om*/
        TableModel model = TagUtils.getModel(this);

        if (StringUtils.isBlank(location) || location.equalsIgnoreCase("toolbar")) {
            model.getTable().setAttribute("ExtendTool", getBodyValue());
        } else if (location.equalsIgnoreCase("top")) {
            model.getTable().setAttribute("ExtendTableTop", getBodyValue());
        } else if (location.equalsIgnoreCase("bottom")) {
            model.getTable().setAttribute("ExtendTableBottom", getBodyValue());
        } else {
            model.getTable().setAttribute("ExtendTool", getBodyValue());
        }

    } catch (Exception e) {
        throw new JspException("TDExtendTag.doAfterBody() Problem: " + ExceptionUtils.formatStackTrace(e));
    }

    return SKIP_BODY;
}

From source file:com.ultrapower.eoms.common.plugin.ecside.tag.ExtendTag.java

 @Override
public int doAfterBody() throws JspException {
     try {//from   w  w  w. j ava2  s . co m
         TableModel model = TagUtils.getModel(this);
            
         if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("toolbar")){
            model.getTable().setAttribute("ExtendTool", getBodyValue());
         }else if (location.equalsIgnoreCase("top")){
            model.getTable().setAttribute("ExtendTableTop", getBodyValue());
         }else if (location.equalsIgnoreCase("bottom")){
            model.getTable().setAttribute("ExtendTableBottom", getBodyValue());
         }else{
            model.getTable().setAttribute("ExtendTool", getBodyValue());
         }

     } catch (Exception e) {
         throw new JspException("TDExtendTag.doAfterBody() Problem: " + ExceptionUtils.formatStackTrace(e));
     }

     return SKIP_BODY;
 }