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:it.eng.spagobi.commons.presentation.tags.LovColumnsSelectorTag.java

public int doStartTag() throws JspException {
    SpagoBITracer.info(SpagoBIConstants.NAME_MODULE, this.getClass().getName(), "doStartTag",
            " method invoked");
    httpRequest = (HttpServletRequest) pageContext.getRequest();
    requestContainer = ChannelUtilities.getRequestContainer(httpRequest);
    responseContainer = ChannelUtilities.getResponseContainer(httpRequest);
    urlBuilder = UrlBuilderFactory.getUrlBuilder();
    msgBuilder = MessageBuilderFactory.getMessageBuilder();

    visColumnsField = msgBuilder.getMessage("SBIDev.queryWiz.visColumnsField", "messages", httpRequest);
    invisColumnsField = msgBuilder.getMessage("SBIDev.queryWiz.invisColumnsField", "messages", httpRequest);
    valueColumnsField = msgBuilder.getMessage("SBIDev.queryWiz.valueColumnsField", "messages", httpRequest);
    descriptionColumnsField = msgBuilder.getMessage("SBIDev.queryWiz.descriptionColumnsField", "messages",
            httpRequest);// w  w w . ja  v a 2s .co  m
    columnsField = msgBuilder.getMessage("SBIDev.queryWiz.columnsField", "messages", httpRequest);

    serviceRequest = requestContainer.getServiceRequest();
    serviceResponse = responseContainer.getServiceResponse();
    errorHandler = responseContainer.getErrorHandler();
    ConfigSingleton configure = ConfigSingleton.getInstance();
    if (moduleName != null) {
        SpagoBITracer.debug(SpagoBIConstants.NAME_MODULE, this.getClass().getName(), "doStartTag",
                "Module Name: " + moduleName);
        moduleResponse = (SourceBean) serviceResponse.getAttribute(moduleName);
    } else {
        SpagoBITracer.critical(SpagoBIConstants.NAME_MODULE, this.getClass().getName(), "doStartTag",
                "Module name not specified");
        throw new JspException("Module name not specified !");
    }
    if (moduleResponse == null) {
        SpagoBITracer.warning(SpagoBIConstants.NAME_MODULE, this.getClass().getName(), "doStartTag",
                "Module response null");
        return SKIP_BODY;
    }
    moduleConfig = (SourceBean) moduleResponse.getAttribute("CONFIG");
    htmlStream = new StringBuffer();
    makeTable();
    try {
        pageContext.getOut().print(htmlStream);
    } catch (Exception ex) {
        SpagoBITracer.critical(SpagoBIConstants.NAME_MODULE, this.getClass().getName(), "doStartTag",
                "Cannot to send the stream", ex);
        throw new JspException("Cannot to send the stream");
    }
    return SKIP_BODY;
}

From source file:org.springmodules.validation.valang.javascript.taglib.ValangValidateTag.java

public int doEndTag() throws JspException {
    try {//from w  w w.  j  a  v  a 2  s .c o m
        Collection rules = new ArrayList();
        if (commandName != null) {
            rules.addAll(getRulesForCommand());
        }
        if (bodyContent != null) {
            rules.addAll(parseRulesFromBodyContent());
        }
        if (rules.size() == 0) {
            throw new JspException("no valang validation rules were found");
        }

        JspWriter out = pageContext.getOut();
        out.write("<script type=\"text/javascript\" id=\"");
        out.write(commandName + "ValangValidator");
        out.write("\">");
        translator.writeJavaScriptValangValidator(out, commandName, true, rules, new MessageSourceAccessor(
                getRequestContext().getWebApplicationContext(), getRequestContext().getLocale()));
        out.write("</script>");
        return EVAL_PAGE;
    } catch (IOException e) {
        throw new JspException("Could not write validation rules", e);
    }
}

From source file:com.adobe.acs.commons.wcm.tags.PlaceholderTag.java

/**
 * {@inheritDoc}//from   w w  w. ja v a 2  s .  c om
 */
@Override
public int doEndTag() throws JspException {
    SlingHttpServletRequest request = TagUtil.getRequest(pageContext);
    Component component = WCMUtils.getComponent(request.getResource());
    if (componentHelper.isEditMode(request)) {
        JspWriter writer = pageContext.getOut();
        String placeholder;

        String bodyContentString = bodyContent != null ? bodyContent.getString() : null;
        if (StringUtils.isNotBlank(bodyContentString)) {
            // use the body content as the default placeholder
            placeholder = Placeholder.getDefaultPlaceholder(request, component, bodyContentString,
                    getDdClass());
        } else {
            String classicUIPlaceholder = componentHelper.generateClassicUIPlaceholder(getAllClassNames(),
                    null);
            placeholder = Placeholder.getDefaultPlaceholder(request, component, classicUIPlaceholder,
                    getDdClass());
        }

        try {
            writer.print(placeholder);
        } catch (IOException e) {
            throw new JspException(e);
        }

    }
    reset();
    return EVAL_PAGE;
}

From source file:com.geemvc.taglib.GeemvcTagSupport.java

protected void writeCloseTag(JspWriter writer, String tagName, boolean hasTagBody) throws JspException {
    try {/*  w  w w  .  j  ava 2s .co  m*/
        if (hasTagBody) {
            writer.write(Char.LESS_THAN);
            writer.write(Char.SLASH);
            writer.write(tagName);
            writer.write(Char.GREATER_THAN);
        } else {
            writer.write(Char.SPACE);
            writer.write(Char.SLASH);
            writer.write(Char.GREATER_THAN);
        }
    } catch (Throwable t) {
        throw new JspException(t);
    }
}

From source file:org.shredzone.cilla.web.tag.FeedTag.java

@Override
public int doEndTag() throws JspException {

    FeedType feedType = FeedType.valueOf(type);

    LinkBuilder lb = linkService.linkTo();
    lb.param("feed", feedType.getSuffix());

    if (category != null) {
        lb.category(category);/*from   w w  w. j  a  va 2s.  c o  m*/

    } else if (tag != null) {
        lb.tag(tag);

    } else if (author != null) {
        lb.author(author);

    } else if (ref != null) {
        lb.ref(ref);
    }

    String url = lb.toString();

    if (var != null) {
        TagUtils.setScopedAttribute(pageContext, var, url, scope);
        return EVAL_PAGE;
    }

    HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();

    StringBuilder linktag = new StringBuilder();
    linktag.append("<link rel=\"alternate\" type=\"").append(feedType.getContentType()).append('"');
    if (title != null) {
        linktag.append(" title=\"");
        linktag.append(HtmlUtils.htmlEscape(title));
        linktag.append('"');
    }
    linktag.append(" href=\"");
    linktag.append(HtmlUtils.htmlEscape(response.encodeURL(url)));
    linktag.append("\" />");

    try {
        pageContext.getOut().print(linktag.toString());
    } catch (IOException ex) {
        throw new JspException(ex);
    }

    return EVAL_PAGE;
}

From source file:org.shredzone.cilla.web.tag.MapTag.java

@Override
public int doEndTag() throws JspException {
    StringBuilder sb = new StringBuilder();
    sb.append("<div id=\"").append(htmlEscape(divId)).append('"');
    if (style != null) {
        sb.append(" style=\"").append(htmlEscape(style)).append('"');
    }/* w  w  w. j  a  v  a 2  s .  c  om*/
    if (styleClass != null) {
        sb.append(" class=\"").append(htmlEscape(styleClass)).append('"');
    }
    sb.append("></div>\n");

    sb.append("<script type=\"text/javascript\">//<![CDATA[\n");
    sb.append(mapService.build(divId, data));
    sb.append("//]]></script>\n");

    data = null;

    if (var != null) {
        TagUtils.setScopedAttribute(pageContext, var, sb.toString(), scope);
        return EVAL_PAGE;
    }

    try {
        pageContext.getOut().print(sb.toString());
    } catch (IOException ex) {
        throw new JspException(ex);
    }

    return EVAL_PAGE;
}

From source file:com.redhat.rhn.frontend.taglibs.list.ListTagUtil.java

/**
 * Writes arbitrary text to the client (browser)
 * @param ctx caller's page context/*from ww w .  j ava  2s. com*/
 * @param text text to write
 * @throws JspException if an error occurs
 */
public static void write(PageContext ctx, String text) throws JspException {
    if (text == null) {
        text = "null";
    }
    Writer writer = ctx.getOut();
    try {
        writer.write(text);
    } catch (IOException e) {
        throw new JspException(e);
    }
}

From source file:ams.fwk.customtag.AmsUploadTag.java

/**
 * @return int/* w w w  .  j a va 2  s  .  com*/
 * @throws JspException
 */
public int doEndTag() throws JspException {
    try {
        List uploads = Collections.EMPTY_LIST;
        if (fileSeqNo != null && fileSeqNo.trim().length() > 0) {
            uploads = getUploads();
        }

        JspWriter out = pageContext.getOut();
        out.print(listOpen);
        int count = 0;
        for (Iterator all = uploads.iterator(); all.hasNext();) {

            Map each = (Map) all.next();
            if ("N/A".equals(typeId) || typeId.equals(each.get("TYPE_ID"))) {
                String temp = StringUtils.replace(listItem, "$filename$", (String) each.get("FILE_NAME"));
                temp = StringUtils.replace(temp, "$max$", "" + max);
                temp = StringUtils.replace(temp, "$typeId$", typeId);
                temp = StringUtils.replace(temp, "$fileId$", (String) each.get("FILE_ID"));
                temp = StringUtils.replace(temp, "$filepath$",
                        StringEscapeUtils.escapeJavaScript((String) each.get("FILE_PATH")));

                out.print(temp);
                count++;

            }
        }
        if (max > count) {
            String requiredTemp = "";
            String temp = "";
            if ("Y".equals(isRequired)) {
                requiredTemp = StringUtils.replace(requiredTag, "$requiredMsg$",
                        StringUtils.isEmpty(requiredMsg) ? "" : requiredMsg);
                temp = StringUtils.replace(fileItem, "$requiredTag$", "" + requiredTemp);
            } else {
                temp = StringUtils.replace(fileItem, "$requiredTag$", "" + "");
            }
            temp = StringUtils.replace(temp, "$max$", "" + max);
            temp = StringUtils.replace(temp, "$typeId$", typeId);
            if ("Y".equals(eachSeqNoFlag)) {
                temp += StringUtils.replace(hiddenTag, "$id$", "eachSeqNoFlag");
                temp = StringUtils.replace(temp, "$name$", "eachSeqNoFlag");
                temp = StringUtils.replace(temp, "$value$", "" + "Y");
            }
            out.print(temp);
        }
        out.print(listClose);

        return EVAL_PAGE;
    } catch (IOException e) {
        throw new JspException(e);
    } finally {
        fileSeqNo = null;
        typeId = "N/A";
        max = 1;
    }
}

From source file:de.laures.cewolf.taglib.tags.ChartImgTag.java

public int doEndTag() throws JspException {
    super.doStartTag();
    final StringBuffer buffer = new StringBuffer(" src=\"");
    buffer.append(getImgURL());/* w  w  w . j a va2s.co m*/
    buffer.append("\"");
    try {
        pageContext.getOut().write(buffer.toString());
    } catch (IOException ioex) {
        reset();
        System.err.println("ChartImgTag.doEndTag: " + ioex.getMessage());
        throw new JspException(ioex.getMessage());
    }
    return super.doEndTag();
}