List of usage examples for javax.servlet.jsp JspException JspException
public JspException(Throwable cause)
JspException
with the specified cause. From source file:net.naijatek.myalumni.util.taglib.LatestMembersTag.java
/** * Process the end of this tag./*from w w w . j a v a2 s . c om*/ * * @throws JspException * if a JSP exception has occurred * @return int */ @Override public final int doEndTag() throws JspException { StringBuffer sb = new StringBuffer(); MemberVO user = new MemberVO(); int numOfMembers = SystemConfigConstants.NumOfLatestMembers; String rootContextName = StringUtil.trimRootContext(request.getContextPath()); try { List<MemberVO> latestmembers = memService.getLatestMembers(numOfMembers); sb.append("<table width=\"" + this.getTableWidth() + "\" border=\"0\" cellspacing=\"1\" cellpadding=\"3\" align=\"center\" class=\"tborder\">"); sb.append("<tr>"); sb.append("<td height=\"30\" class=\"bg0\">Most Recent Members</td>"); sb.append("</tr>"); int size = latestmembers.size(); for (int i = 0; i < size; i++) { user = (MemberVO) latestmembers.get(i); sb.append("<tr class=\"portlet-section-body\">"); sb.append("<td><div class=\"blacksmall\"> <a href=\"/" + rootContextName + "/action/member/displayMiniProfile?action=displayMiniProfile&memberUserName=" + user.getMemberUserName() + "\" + onclick=\"newPopup(this.href,'name');return false\" title=\"View " + user.getFirstName() + " " + user.getLastName() + " details\"> " + user.getFirstName() + " " + user.getLastName() + " (" + user.getYearOut() + ")</div></td>"); sb.append("</tr>"); } if (size == 0) { sb.append("<td>None.</td>"); } sb.append("</table>"); } catch (Exception ex) { logger.error(ex.getMessage()); throw new JspException("IO Problem in LatestMembersTag " + ex.getMessage()); } try { pageContext.getOut().print(sb.toString()); } catch (Exception e) { logger.debug(e.getMessage()); throw new JspException("IO Problem in LatestMembersTag " + e.getMessage()); } return EVAL_PAGE; }
From source file:net.sf.xplanner.tags.NavigationBarTag.java
@Override public int doEndTag() throws JspException { try {/*from ww w. jav a2s . c om*/ int objectId = this.oid; if (objectId == 0 && this.pageContext.getRequest().getParameter("oid") != null) { objectId = NumberUtils.toInt(this.pageContext.getRequest().getParameter("oid")); } if (objectId == 0 && this.pageContext.getRequest().getParameter("fkey") != null) { objectId = NumberUtils.toInt(this.pageContext.getRequest().getParameter("fkey")); } if (this.object == null && objectId > 0 && this.type != null) { this.setObject(objectId); } final DomainContext domainContext = this.getContext(this.object); this.render(domainContext); } catch (final JspException e) { throw e; } catch (final Exception e) { throw new JspException(e); } return Tag.EVAL_PAGE; }
From source file:org.shredzone.cilla.web.tag.ImageTag.java
@Override public int doStartTag() throws JspException { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String url = null;/* w w w. java2s . c o m*/ Integer outWidth = null, outHeight = null; LinkBuilder lb = linkService.linkTo(); if (picture != null) { lb.view("picture").picture(picture); unlockService.unlockStore(request.getSession(), picture); if (type != null) { lb.param("type", type); } else { outWidth = picture.getWidth(); outHeight = picture.getHeight(); } url = lb.toString(); } else if (header != null && (uncropped == null || uncropped == false)) { lb.view("headerImage").header(header).toString(); if (type != null) { lb.param("type", type); } else { outWidth = header.getWidth(); outHeight = header.getHeight(); } url = lb.toString(); } else if (header != null && uncropped != null && uncropped == true) { lb.view("headerUncropped").header(header); if (type != null) { lb.param("type", type); } url = lb.toString(); } else if (medium != null) { lb.view("medium").page(medium.getPage()).param("name", medium.getImage().getName()); if (type != null) { lb.param("type", type); } url = lb.toString(); } if (url == null) { throw new JspException("No image target was set, or image was not found."); } if (var != null) { TagUtils.setScopedAttribute(pageContext, var, url, scope); return EVAL_BODY_INCLUDE; } HttpServletResponse response = (HttpServletResponse) pageContext.getResponse(); StringBuilder imgtag = new StringBuilder(); imgtag.append("<img src=\""); imgtag.append(HtmlUtils.htmlEscape(response.encodeURL(url))); imgtag.append('"'); if (outWidth != null) { imgtag.append(" width=\"").append(outWidth).append('"'); } if (outHeight != null) { imgtag.append(" height=\"").append(outHeight).append('"'); } if (styleClass != null) { imgtag.append(" class=\"").append(HtmlUtils.htmlEscape(styleClass)).append('"'); } if (style != null) { imgtag.append(" style=\"").append(HtmlUtils.htmlEscape(style)).append('"'); } if (title != null) { imgtag.append(" title=\"").append(HtmlUtils.htmlEscape(title)).append('"'); } if (alt != null) { imgtag.append(" alt=\"").append(HtmlUtils.htmlEscape(alt)).append('"'); } imgtag.append(" />"); try { pageContext.getOut().print(imgtag.toString()); } catch (IOException ex) { throw new JspException(ex); } return EVAL_BODY_INCLUDE; }
From source file:net.naijatek.myalumni.util.taglib.BuildDropdownTag.java
/** * Process the end of this tag.//ww w . ja va 2 s . c o m * * @exception JspException if a JSP exception has occurred * @return int */ public final int doEndTag() throws JspException { StringBuffer sbContent = new StringBuffer(); String value = null; value = renderSelectStartElement(); if (value != null) sbContent.append(value); sbContent.append(renderListOptions()); sbContent.append("</select>"); try { pageContext.getOut().print(sbContent.toString()); } catch (Exception e) { logger.debug(e.getMessage()); throw new JspException("IO Problem in BuildDropdownTag " + e.getMessage()); } return EVAL_PAGE; }
From source file:com.redhat.rhn.frontend.taglibs.list.ColumnTag.java
/** * ${@inheritDoc}//from ww w .j a v a 2 s.c o m */ public int doEndTag() throws JspException { if (sortable && attributeName == null && sortAttribute == null) { throw new JspException("Sortable columns must use either attr or sortAttr"); } checkForBoundsAndAttrs(); ListCommand command = ListTagUtil.getCurrentCommand(this, pageContext); if (command.equals(ListCommand.RENDER)) { ListTagUtil.write(pageContext, "</td>"); } else if (command.equals(ListCommand.ENUMERATE) && !StringUtils.isBlank(filterAttr)) { setupColumnFilter(); } return BodyTagSupport.EVAL_PAGE; }
From source file:com.geemvc.taglib.GeemvcTagSupport.java
protected void writeTagAttributes(JspWriter writer) throws JspException { Set<Entry<String, Object>> attributes = dynamicAttributes.entrySet(); try {// w ww.j a v a 2s .c o m for (Entry<String, Object> attr : attributes) { writer.write(Char.SPACE); writer.write(attr.getKey()); writer.write(Char.EQUALS); writer.write(Char.DOUBLE_QUOTE); writer.write(String.valueOf(attr.getValue())); writer.write(Char.DOUBLE_QUOTE); } } catch (Throwable t) { throw new JspException(t); } }
From source file:com.xhsoft.framework.common.page.PageTag.java
/** * <p>Description:build up goto text area and print</p> * @param request //w w w. j a v a 2s . com * @param pageNo * @param totalPages * @return void * @author wenzhi * @version 1.0 * @exception Exception */ private void buildGoto(HttpServletRequest request, int pageNo, int totalPages) throws JspException { try { JspWriter out = pageContext.getOut(); if (StringUtils.isEmpty(pageSizeList)) { pageSizeList = INIT_PAGE_SIZE_LIST; } @SuppressWarnings("unused") String[] pageSizes = pageSizeList.split(","); String rand = UUID.randomUUID().toString(); String outString = "<input name=\"gotoText" + rand + "\" type=\"text\" size=\"5\" value=\"" + pageNo + "\" onkeydown=\"return gotoPage(this.value,'" + pageNo + "','" + totalPages + "','" + targets + "');\">" + "<input type=\"button\" name=\"go\" value=\"GO\" class=\"button2\" onclick=\"return gotoPageDirect(dojo.byId('gotoText" + rand + "').value,'" + pageNo + "','" + totalPages + "','" + targets + "');\">"; out.print(outString); } catch (Exception e) { throw new JspException(e); } }
From source file:se.softhouse.garden.orchid.spring.tags.OrchidMessageTag.java
/** * Write the message to the page./*from www.j a va 2 s.com*/ * <p> * Can be overridden in subclasses, e.g. for testing purposes. * * @param msg * the message to write * @throws IOException * if writing failed */ protected void writeMessage(String msg) throws JspException { try { this.pageContext.getOut().print(String.valueOf(msg)); } catch (IOException e) { throw new JspException(e); } }
From source file:net.sf.ginp.tags.GetPictures.java
/** * Called when a Start tag is processed. * *@return Description of the Return Value *@exception JspException Description of the Exception *///w w w . j a va 2s. c o m public final int doStartTag() throws JspException { try { model = ModelUtil.getModel((HttpServletRequest) pageContext.getRequest()); } catch (Exception e) { log.error(e); throw new JspException(e); } columbs = (model.getPageWidth() - boderhorizontal) / (Configuration.getThumbSize() + boderpicture); rows = (model.getPageHeight() - bodervertical) / (Configuration.getThumbSize() + boderpicture); if (model.getCollection() != null) { if (showpages) { count = model.getPagePosition(); // go back a page or two if (model.getPageOffset() == (-2)) { count = count - (columbs * rows * 2); model.setPageOffset(0); } // make sure there is something to see. if (count < 0) { count = 0; } else if (model.getCollection().getPictureLength() <= (count + 1)) { count = model.getCollection().getPictureLength() - (columbs * rows); if (count < 0) { count = 0; } } } else { count = 0; } startAt = count; if (model.getCollection().getPictureLength() > count) { collAbsPath = model.getCollection().getRoot() + model.getCollection().getPath(); if (model.getCurrCollectionId() == -1) { return SKIP_BODY; } end = model.getCollection().getPictureLength(); pic = new Picture(collAbsPath, model.getCollection().getPicture(count)); if (log.isDebugEnabled()) { log.debug("doStartTag() - filename: " + pic.getFileName()); } // Set Picture Attributes setAttributes(pic); return EVAL_BODY_INCLUDE; } return SKIP_BODY; } return SKIP_BODY; }
From source file:jp.terasoluna.fw.web.taglib.IfAuthorizedBlockTag.java
/** * ^O{fB?I?\bh?B//w w w .j a v a 2 s .c om * * @return ???w * @throws JspException JSPO */ @Override public int doAfterBody() throws JspException { // u?bN? Boolean blockInfo = null; try { // pageContext u?bN? blockInfo = (Boolean) pageContext.getAttribute(this.blockId); } catch (ClassCastException e) { if (log.isWarnEnabled()) { log.warn("Class cast error.", e); } } // {fB?o boolean outputBody = false; if (blockInfo != null && blockInfo.booleanValue()) { //blockInfonulltrue?? outputBody = true; } // ?eu?bN? if (this.parentBlockId != null) { // ANZX`FbN pageContext.setAttribute(this.parentBlockId, new Boolean(outputBody)); } // {fB?o if (outputBody) { try { bodyContent.writeOut(bodyContent.getEnclosingWriter()); } catch (IOException e) { log.error("Output error."); throw new JspException(e); } } // {fB?] return SKIP_BODY; }