List of usage examples for javax.servlet.jsp JspException JspException
public JspException(Throwable cause)
JspException
with the specified cause. From source file:com.googlecode.spring.appengine.taglib.ApplicationVersionTag.java
@Override public int doEndTag() throws JspException { String applicationVersion = SystemProperty.applicationVersion.get(); if (ignoreMinorVersion) { if (applicationVersion.contains(".")) { applicationVersion = applicationVersion.substring(0, applicationVersion.lastIndexOf(".")); }/*w ww. j a v a2 s. c o m*/ } if (var == null) { try { pageContext.getOut().print(applicationVersion); } catch (IOException e) { throw new JspException(e); } } else { pageContext.setAttribute(var, applicationVersion, scope); } return Tag.EVAL_PAGE; }
From source file:se.softhouse.garden.orchid.spring.tags.OrchidArgTag.java
@Override public int doEndTag() throws JspException { Object argument = null;//from w ww. j a va 2s . c om if (this.value != null) { argument = resolveArgument(this.value); } else if (getBodyContent() != null) { // get the value from the tag body argument = resolveArgument(getBodyContent().getString().trim()); } // find a arg aware ancestor OrchidArgAware argAwareTag = (OrchidArgAware) findAncestorWithClass(this, OrchidArgAware.class); if (argAwareTag == null) { throw new JspException("The arg tag must be a descendant of a tag that supports arguments"); } argAwareTag.addArg(this.name, argument); return EVAL_PAGE; }
From source file:com.jaspersoft.jasperserver.war.tags.ListReportsTag.java
public int doStartTag() throws JspException { try {// www. j a va 2 s .c o m //this method should call the MD API - it may be a pseudo implementation also //It should return a Collection of RU-objects - We need to create a Domain //object for RU. We have to populate this RU object which we read from the Metadata Repository //set this Collection object from in request scope and access in the JSP page } catch (Exception _ex) { if (log.isErrorEnabled()) log.error(_ex, _ex); throw new JspException(_ex); } return Tag.SKIP_BODY; }
From source file:com.geemvc.taglib.html.MessageTagSupport.java
@Override public void doTag() throws JspException { if (locale != null && (lang != null || country != null)) throw new JspException( "You can only set one of of either 'locale' or a 'language/country' combination."); if (lang != null && country != null) locale = new Locale(lang, country); else if (lang != null) locale = new Locale(lang); String label = null;//from w w w.jav a2s . com // Handle string keys normally. if (key instanceof String) { label = messageResolver.resolve((String) key, locale, requestContext(), true); } else if (key.getClass().isEnum()) { // Attempt to resolve <enun-fqn>.<enum-value>. label = messageResolver.resolve( new StringBuilder(key.getClass().getName()).append(Char.DOT).append(key).toString(), requestContext(), true); // Attempt to resolve <enun-simple-name>.<enum-value>. if (label == null) label = messageResolver.resolve( new StringBuilder(key.getClass().getSimpleName()).append(Char.DOT).append(key).toString(), requestContext(), true); } else if (key instanceof Boolean) { // Attempt to resolve Boolean.true or Boolean.false. label = messageResolver.resolve(new StringBuilder(Boolean.class.getSimpleName()).append(Char.DOT) .append(String.valueOf(key).toLowerCase()).toString(), requestContext(), true); } else { throw new JspException("The type '" + key.getClass().getName() + "' cannot be used as a message key in MessageTagSupport. Only the types String, Boolean or enums are supported."); } if (label != null) { if (escapeHTML) label = StringEscapeUtils.escapeHtml4(label); if (escapeJavascript) label = StringEscapeUtils.escapeEcmaScript(label); if (escapeJson) label = StringEscapeUtils.escapeJson(label); if (unescapeHTML) label = StringEscapeUtils.unescapeHtml4(label); if (unescapeJavascript) label = StringEscapeUtils.unescapeEcmaScript(label); if (unescapeJson) label = StringEscapeUtils.unescapeJson(label); } if (label == null) { label = getBodyContent(); if (label == null) label = String.format("???%s???", key); } // Deal with parameters. if (label != null) { List<Object> params = messageParameters(); if (params != null && !params.isEmpty()) label = MessageFormat.format(label, params.toArray()); } if (!Str.isEmpty(var)) { jspContext.setAttribute(var, label, scope()); } else { try { jspContext.getOut().write(label); } catch (IOException e) { throw new JspException(e); } } }
From source file:psiprobe.jsp.ParamToggleTag.java
@Override public int doStartTag() throws JspException { boolean getSize = ServletRequestUtils.getBooleanParameter(pageContext.getRequest(), param, false); StringBuilder query = new StringBuilder(); query.append(param).append("=").append(!getSize); String encoding = pageContext.getResponse().getCharacterEncoding(); for (String name : Collections.list(pageContext.getRequest().getParameterNames())) { if (!param.equals(name)) { try { String value = ServletRequestUtils.getStringParameter(pageContext.getRequest(), name, ""); String encodedValue = URLEncoder.encode(value, encoding); query.append("&").append(name).append("=").append(encodedValue); } catch (UnsupportedEncodingException e) { throw new JspException(e); }// ww w. j av a 2s . c o m } } try { pageContext.getOut().print(query); } catch (IOException e) { logger.debug("Exception printing query string to JspWriter", e); throw new JspException(e); } return EVAL_BODY_INCLUDE; }
From source file:com.googlecode.spring.appengine.taglib.UserTag.java
@Override public int doEndTag() throws JspException { Object result = null;/*from ww w .j a v a 2 s .co m*/ if (property != null) { User user = UserServiceFactory.getUserService().getCurrentUser(); if (user != null) { try { BeanWrapperImpl wrapper = new BeanWrapperImpl(user); result = wrapper.getPropertyValue(property); } catch (BeansException e) { throw new JspException(e); } } } if (var == null) { try { pageContext.getOut().print(result); } catch (IOException e) { throw new JspException(e); } } else { pageContext.setAttribute(var, result, scope); } return Tag.EVAL_PAGE; }
From source file:org.jamwiki.taglib.WatchlistTag.java
/** * *//*from w w w. j a v a2 s.co m*/ public int doStartTag() throws JspException { try { String tagValue = evaluateTag(); HttpServletRequest request = (HttpServletRequest) this.pageContext.getRequest(); String virtualWiki = WikiUtil.getVirtualWikiFromRequest(request); Watchlist watchlist = WikiUtil.currentWatchlist(request, virtualWiki); if (watchlist.containsTopic(tagValue)) { this.pageContext.getOut().print("<strong>"); } } catch (Exception e) { logger.severe("Failure processing watchlist item " + this.topic, e); throw new JspException(e); } return EVAL_BODY_INCLUDE; }
From source file:com.siemens.sw360.portal.tags.links.DisplayDownloadAttachment.java
@Override public int doStartTag() throws JspException { try {//from w w w.j av a 2s .c om JspWriter jspWriter = pageContext.getOut(); jspWriter.write("<a href='"); resourceUrl(pageContext).withParam(PortalConstants.ACTION, PortalConstants.ATTACHMENT_DOWNLOAD) .withParam(PortalConstants.ATTACHMENT_ID, id).writeUrlToJspWriter(); jspWriter .write(format("'><img src='%s/images/downloadEnable.jpg' alt='Download%s' title='Download%s'/>", getContext(), name, name)); jspWriter.write("</a>"); } catch (Exception e) { throw new JspException(e); } return SKIP_BODY; }
From source file:net.sf.ginp.tags.NavUp.java
/** * Called when a Start tag is processed. * *@return Description of the Return Value *@exception JspException Description of the Exception *//*from www.j a v a2 s .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); } pageContext.setAttribute("link", "ginpservlet?cmd=selectpath&colid=" + model.getCurrCollectionId() + "&path=" + model.getCollection().getPath() + "&colid=" + model.getCurrCollectionId()); return EVAL_BODY_AGAIN; }