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:org.ecside.tag.TrTag.java

public int doEndTag() throws JspException {
   try{/*from  w  ww .j a  v  a  2 s.c o m*/
      if (!TagUtils.isIteratingBody(this)) {
         if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("top")){
            location="Top";
         }else if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("before")){
            location="Before";
         }else if (StringUtils.isBlank(location)|| location.equalsIgnoreCase("After")){
            location="After";
         }
         List trList=(List)model.getTable().getAttribute("ExtendTableTrList"+location);
         if (trList==null){
            trList=new ArrayList();
         }
         trList.add(trBean);
         model.getTable().setAttribute("ExtendTableTrList"+location, trList);
      }
} catch (Exception e) {
    throw new JspException("TrTag.doEndTag() Problem: " + ExceptionUtils.formatStackTrace(e));
}
   return super.doEndTag();
}

From source file:org.encuestame.mvc.tag.IncludeResource.java

public int doStartTag() throws JspException {
    try {//from   w ww .  ja  v  a  2 s  . c  o m
        final JspWriter out = pageContext.getOut();
        final StringBuffer buffer = new StringBuffer("<div");
        if (StringUtils.startsWith(type, "encuestame.org")) {
            buffer.append(" dojoType=\"");
            buffer.append(type);
            buffer.append("\">");
        } else {
            buffer.append("> ");
        }
        buffer.append(" </div>");
        out.write(buffer.toString());
    } catch (Exception e) {
        throw new JspException(e.getMessage());
    }
    return EVAL_PAGE;
}

From source file:org.fireflow.webdesigner.tag.ProcessDiagramTag.java

@Override
public int doStartTag() throws JspException {
    HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest();
    boolean isIE = BrowserUtils.isIE(request);
    double ieVersion = BrowserUtils.getIEversion(request);

    init(isIE, ieVersion);//?

    StringBuffer sbuf = new StringBuffer();

    //1?include js,css??ie6,7,8
    sbuf.append(buildIncludeResources(isIE, ieVersion));

    //2?container div
    sbuf.append(buildContainerDiv());/*from  www. j  a va 2s  .  co m*/

    //sbuf.append("<table width=\"100%\" height=\"100%\" cellspacing=\"0\" cellpadding=\"0\"><tr height=\"24px\"><td>");
    //3?toolbar 
    sbuf.append(this.buildToolBarDiv());

    //sbuf.append("</td></tr>").append("<tr  height=\"100%\"><td>");

    //4?iframe
    if (isIE && ieVersion < 9) {
        sbuf.append(this.buildSvgVmlIframe(false));
    } else {
        sbuf.append(this.buildSvgVmlIframe(true));
    }

    //4?svgvml?div
    //      sbuf.append("<div  id=\"")
    //         .append(this.svgVmlWrapperDivId).append("\" style=\"width:100%;height:100%\">\n");
    //      sbuf.append("<div").append("\" style=\"width:100%;height:100%\">\n");

    //5?svgvml   

    /*
    String diagram = "";
    if (isIE){
       if (ieVersion<9){
    diagram = buildVMLDiagram();
       }else{
    diagram = buildSVGDiagram();
       }
               
    }else{
       diagram = buildSVGDiagram();
    }
            
    sbuf.append(diagram);
            
    */

    //      sbuf.append("\n</div>\n");//svg wrapper div

    //      sbuf.append("\n</td></tr></table>\n");

    sbuf.append("</div>\n");//container div
    /*
    if (isIE && ieVersion<9){
       sbuf.append("<script>\n")
    .append("fireflowDiagramInit(\"").append(this.svgVmlId).append("\");\n")
    .append("</script>\n");
    }
    */
    try {
        pageContext.getOut().write(sbuf.toString());
    } catch (IOException e) {
        throw new JspException(e);
    }

    return SKIP_BODY;
}

From source file:org.gbif.portal.web.tag.AlphabetLinkTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
 *///from  w  w  w  . j  ava2  s  .  c om
@Override
public int doStartTag() throws JspException {
    if (letters == null || letters.isEmpty()) {
        return super.doStartTag();
    }

    StringBuffer sb = new StringBuffer();
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    String contextPath = request.getContextPath();
    List<Character> ignoreChars = new ArrayList<Character>();

    if (StringUtils.isNotEmpty(ignores)) {
        ignores = ignores.trim();
        StringTokenizer st = new StringTokenizer(ignores);
        while (st.hasMoreTokens()) {
            String ignoreChar = st.nextToken();
            if (ignoreChar.length() != 1) {
                throw new JspException("Invalid ignore list :" + ignoreChar);
            }
            ignoreChars.add(new Character(ignoreChar.charAt(0)));
        }
    }

    sb.append("<ul class=\"");
    sb.append(listClass);
    sb.append("\">");
    sb.append("<li class=\"lt\">");

    int indexOfSelected = letters.indexOf(selected);

    if (indexOfSelected > 0) {
        addLink(sb, contextPath, letters.get(indexOfSelected - 1), "&lt;&lt;");
    } else {
        sb.append("&lt;&lt;");
    }
    sb.append("</li>");

    List acceptedChars = Arrays.asList(accepted);
    for (Character letter : letters) {
        if (!ignoreChars.contains(letter) && acceptedChars.contains(letter.toString())) {
            sb.append("<li");
            if (selected != letter) {
                sb.append('>');
                addLink(sb, contextPath, letter);
            } else {
                sb.append(" id=\"chosen\">");
                sb.append(letter);
            }
            sb.append("</li>");
        }
    }

    sb.append("<li class=\"lt\">");

    if (indexOfSelected < (letters.size() - 1)) {
        addLink(sb, contextPath, letters.get(indexOfSelected + 1), "&gt;&gt;");
    } else {
        sb.append("&gt;&gt;");
    }
    sb.append("</li>");
    sb.append("</ul>");

    try {
        pageContext.getOut().write(sb.toString());
    } catch (IOException e) {
        throw new JspException(e);
    }
    return super.doStartTag();
}

From source file:org.gbif.portal.web.tag.CapitalizeAllTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
 *//* w  ww .  j ava 2 s  . c o  m*/
@Override
public int doEndTag() throws JspException {

    String string2Capitalize = this.bodyContent.getString();
    if (StringUtils.isNotEmpty(string2Capitalize)) {
        try {
            string2Capitalize = string2Capitalize.trim();
            string2Capitalize = string2Capitalize.toLowerCase();
            pageContext.getOut().print(WordUtils.capitalizeFully(string2Capitalize, ignores));
        } catch (IOException e) {
            throw new JspException(e);
        }
    }
    return super.doEndTag();
}

From source file:org.gbif.portal.web.tag.CapitalizeFirstCharTag.java

/**
 * @see javax.servlet.jsp.tagext.TagSupport#doEndTag()
 *//*from   w ww .j  ava  2  s. com*/
@Override
public int doEndTag() throws JspException {

    String string2Capitalize = this.bodyContent.getString();
    if (StringUtils.isNotEmpty(string2Capitalize)) {
        try {
            string2Capitalize = string2Capitalize.trim();
            string2Capitalize = string2Capitalize.toLowerCase();
            pageContext.getOut().print(StringUtils.capitalize(string2Capitalize));
        } catch (IOException e) {
            throw new JspException(e);
        }
    }
    return super.doEndTag();
}

From source file:org.gbif.portal.web.tag.CriterionTag.java

@Override
public int doStartTag() throws JspException {
    try {//w  ww  .j av a2  s. c o m
        String criterion = CriteriaUtil.getUrl(subject, predicate, value, index);
        if (urlEncode)
            criterion = URLEncoder.encode(criterion, "UTF-8");
        pageContext.getOut().print(criterion);
    } catch (IOException e) {
        throw new JspException(e);
    }
    return SKIP_BODY;
}