List of usage examples for javax.servlet.jsp JspWriter write
public void write(int c) throws IOException
From source file:org.commoncrawl.service.crawler.CrawlQueue.java
public void dumpHostDetailsToHTML(JspWriter out, int hostIP) throws IOException { CrawlQueueHost host = _activeHosts.get(hostIP); if (host != null) { out.write("<h2>Host Details for Host:" + host.getIPAddressAsString() + "</h2><BR>"); out.write("<pre>"); host.dumpDetails(out);// w ww . j av a 2s .c om out.write("</pre>"); } }
From source file:org.displaytag.decorator.CheckboxTableDecorator.java
/** * @see org.displaytag.decorator.TableDecorator#finish() *///from www . java2 s. c o m public void finish() { if (!checkedIds.isEmpty()) { JspWriter writer = getPageContext().getOut(); for (Iterator it = checkedIds.iterator(); it.hasNext();) { String name = (String) it.next(); StringBuffer buffer = new StringBuffer(); buffer.append("<input type=\"hidden\" name=\""); buffer.append(fieldName); buffer.append("\" value=\""); buffer.append(name); buffer.append("\">"); try { writer.write(buffer.toString()); } catch (IOException e) { // should never happen } } } super.finish(); }
From source file:org.eclipse.sw360.portal.tags.TagUtils.java
public static void addDownloadLink(PageContext pageContext, JspWriter jspWriter, String name, Collection<String> ids, String contextType, String contextId) throws IOException, JspException { name = name != null ? escapeAttributeValue(name) : NO_FILENAME; jspWriter.write("<a href='"); UrlWriter urlWriter = resourceUrl(pageContext) .withParam(PortalConstants.ACTION, PortalConstants.ATTACHMENT_DOWNLOAD) .withParam(PortalConstants.CONTEXT_TYPE, contextType) .withParam(PortalConstants.CONTEXT_ID, contextId); for (String id : ids) { urlWriter.withParam(PortalConstants.ATTACHMENT_ID, id); }/*from ww w. j a v a 2 s. c om*/ urlWriter.writeUrlToJspWriter(); jspWriter .write(format("'><img src='%s/images/download_enabled.jpg' alt='Download %s' title='Download %s'/>", ((HttpServletRequest) pageContext.getRequest()).getContextPath(), name, name)); jspWriter.write("</a>"); }
From source file:org.ecside.tag.MappingTag.java
public int doStartTag() throws JspException { try {/* w w w .j a va 2 s. c o m*/ Object propertyValue = getValue(); if (propertyValue != null) { propertyValue = ExpressionEvaluatorManager.evaluate("result", propertyValue.toString(), Object.class, this, pageContext); } if (mappingItem!=null ){ Object mappingMap=pageContext.findAttribute((String)mappingItem); Object outValue=null; if (mappingMap instanceof Map){ Map itemsMap=(Map)mappingMap; outValue=itemsMap.get(propertyValue); if (outValue==null && mappingDefaultKey!=null){ outValue=itemsMap.get(mappingDefaultKey); } } if (outValue==null){ outValue=mappingDefaultValue; } propertyValue=outValue; } JspWriter w = pageContext.getOut(); if (propertyValue == null || (propertyValue != null && propertyValue instanceof String && StringUtils.isBlank((String)propertyValue))) { w.write(""); }else{ w.write((String)propertyValue); } } catch (Exception e) { throw new JspException("MappingTag.doStartTag() Problem: " + ExceptionUtils.formatStackTrace(e)); } return SKIP_BODY; }
From source file:org.encuestame.mvc.tag.IncludeResource.java
public int doStartTag() throws JspException { try {//from w w w . j av a2s . 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.entando.entando.aps.tags.ExtendedTagSupport.java
public static void out(PageContext pageContext, boolean escapeXml, Object obj) throws IOException { if (null != obj) { String text = (escapeXml) ? StringEscapeUtils.escapeXml(obj.toString()) : obj.toString(); JspWriter w = pageContext.getOut(); w.write(text); }// w w w . ja v a 2s.com }
From source file:org.esco.portlets.news.web.support.CheckboxTableDecorator.java
/** * //from w w w . j ava 2s. com */ @Override public void finish() { if (!checkedIds.isEmpty()) { final JspWriter writer = getPageContext().getOut(); for (final Iterator<String> it = checkedIds.iterator(); it.hasNext();) { final String name = it.next(); final StringBuffer buffer = new StringBuffer(); buffer.append("<input type=\"hidden\" name=\""); buffer.append(fieldName); buffer.append("\" value=\""); buffer.append(name); buffer.append("\">"); try { writer.write(buffer.toString()); } catch (final IOException e) { // should never happen } } } super.finish(); }
From source file:org.hyperic.hq.ui.taglib.OptionMessageListTag.java
/** * Process the tag, generating and formatting the list. * * @exception JspException if the scripting variable can not be * found or if there is an error processing the tag *///ww w.j ava 2 s . c o m public final int doStartTag() throws JspException { try { SelectTag selectTag = (SelectTag) pageContext.getAttribute(Constants.SELECT_KEY); Object collection = TagUtils.getInstance().lookup(pageContext, name, property, null); if (collection == null) { _log.warn("OptionMessageList tag was looking for bean=" + name + " property=" + property + " but it wasn't " + "found"); throw new JspTagException("Unable to find bean=" + name + " property=" + property); } JspWriter out = pageContext.getOut(); StringBuffer sb = new StringBuffer(); for (Iterator i = getIterator(collection); i.hasNext();) { Object next = i.next(); String value, key; if (next instanceof LabelValueBean) { LabelValueBean bean = (LabelValueBean) next; value = bean.getValue(); key = _baseKey + '.' + bean.getLabel(); } else { value = String.valueOf(next); key = _baseKey + '.' + value; } String label = TagUtils.getInstance().message(pageContext, _bundle, _locale, key); addOption(sb, label, value, selectTag.isMatched(value)); } out.write(sb.toString()); return SKIP_BODY; } catch (IOException e) { _log.warn("Unabel to generate message list", e); throw new JspTagException(e.toString()); } catch (JspException e) { _log.warn("Unabel to generate message list", e); throw new JspTagException(e.toString()); } catch (Exception e) { _log.warn("Unable to generate message list", e); throw new JspTagException(e.toString()); } }
From source file:org.kuali.kfs.sys.document.web.renderers.AccountingLineTableHeaderRenderer.java
/** * Renders the header for the accounting line table to the screen * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag) *//*w w w .j a v a2 s. co m*/ public void render(PageContext pageContext, Tag parentTag) throws JspException { JspWriter out = pageContext.getOut(); try { out.write(buildDivStart()); out.write(buildTableStart()); out.write(buildSubheadingWithDetailToggleRowBeginning()); renderHideDetails(pageContext, parentTag); out.write(buildSubheadingWithDetailToggleRowEnding()); } catch (IOException ioe) { throw new JspException("Difficulty rendering AccountingLineTableHeader", ioe); } }
From source file:org.kuali.kfs.sys.document.web.renderers.ActionsRenderer.java
/** * //w ww . j av a 2 s .c om * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag) */ public void render(PageContext pageContext, Tag parentTag) throws JspException { actionButton.setPageContext(pageContext); actionButton.setParent(parentTag); JspWriter out = pageContext.getOut(); try { if (actions != null && actions.size() > 0) { out.write(this.getTagBeginning()); for (AccountingLineViewAction action : actions) { renderAction(action); out.write(this.getPostButtonSpacing()); } out.write(this.getTagEnding()); } else { out.write(buildNonBreakingSpace()); } } catch (IOException ioe) { throw new JspException("Difficulty rendering actions block", ioe); } }