Java Code Examples for javax.servlet.jsp.JspWriter#write()
The following examples show how to use
javax.servlet.jsp.JspWriter#write() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TableCellRenderer.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
/** * Renders the table cell as a header cell as well as rendering all children renderable elements of the cell * @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 { JspWriter out = pageContext.getOut(); try { out.write(buildBeginningTag()); if (cell.hasChildElements()) { cell.renderChildrenElements(pageContext, parentTag); } else { out.write(" "); } out.write(buildEndingTag()); } catch (IOException ioe) { throw new JspException("Difficulty rendering table cell", ioe); } }
Example 2
Source File: RequiredFieldTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public int doStartTag() throws JspException { // <bean:message key="cobbler.snippet.name"/> // <span class="required-form-field">*</span> LocalizationService ls = LocalizationService.getInstance(); JspWriter writer = pageContext.getOut(); try { if (!StringUtils.isBlank(key)) { String msg = ls.getMessage(key); if (msg.endsWith(":")) { msg = msg.substring(0, msg.length() - 1); } writer.write(msg); } return EVAL_BODY_INCLUDE; } catch (IOException e) { throw new JspException(e); } }
Example 3
Source File: ConfigChannelTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public int doEndTag() throws JspException { StringBuilder result = new StringBuilder(); if (nolink || id == null) { result.append(writeIcon()); result.append(name); } else { result.append("<a href=\"" + ConfigChannelTag.makeConfigChannelUrl(id) + "\">"); result.append(writeIcon()); result.append(StringEscapeUtils.escapeXml(name) + "</a>"); } JspWriter writer = pageContext.getOut(); try { writer.write(result.toString()); } catch (IOException e) { throw new JspException(e); } return BodyTagSupport.SKIP_BODY; }
Example 4
Source File: ToolTipTag.java From spacewalk with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public int doStartTag() throws JspException { LocalizationService ls = LocalizationService.getInstance(); HtmlTag strong = new HtmlTag("strong"); strong.addBody(ls.getMessage(geTypeKey()) + ": "); JspWriter writer = pageContext.getOut(); try { writer.write("<p class=\"small-text\">"); writer.write(strong.render()); if (!StringUtils.isBlank(key)) { writer.write(ls.getMessage(key)); } return EVAL_BODY_INCLUDE; } catch (IOException e) { throw new JspException(e); } }
Example 5
Source File: SubMetricTag.java From jstorm with Apache License 2.0 | 6 votes |
@Override public void doTag() throws JspException { JspWriter out = getJspContext().getOut(); try { StringBuilder sb = new StringBuilder(); if (metric.size() > 0) { if (isHidden) { sb.append(String.format("<div class='%s hidden'>", clazz)); } else { sb.append(String.format("<div class='%s'>", clazz)); } for (String parent : parentComp) { String key = metricName + "@" + parent; String v = metric.get(key); if (v != null) { sb.append(v); } sb.append("<br/>"); } sb.append("</div>"); out.write(sb.toString()); } } catch (IOException e) { throw new JspException("Error: " + e.getMessage()); } }
Example 6
Source File: RequiredFieldTag.java From uyuni with GNU General Public License v2.0 | 6 votes |
/** * {@inheritDoc} */ public int doEndTag() throws JspException { JspWriter writer = pageContext.getOut(); //<span class="required-form-field">*</span> HtmlTag span = new HtmlTag("span"); span.setAttribute("class", REQUIRED_FIELD_CSS); span.addBody("*"); try { writer.write(span.render()); if (!StringUtils.isBlank(key)) { LocalizationService ls = LocalizationService.getInstance(); String msg = ls.getMessage(key); if (msg.endsWith(":")) { writer.write(":"); } } } catch (IOException e) { throw new JspException(e); } return SKIP_BODY; }
Example 7
Source File: Report.java From attic-stratos with Apache License 2.0 | 5 votes |
public int doStartTag() throws JspException { //check permission. HttpServletRequest req = (HttpServletRequest) pageContext.getRequest(); if(!CarbonUIUtil.isUserAuthorized(req, "/permission/admin/manage/report")){ return EVAL_PAGE; } JspWriter writer = pageContext.getOut(); String context = "<div style='float:right;padding-bottom:5px;padding-right:15px;'>"; if(pdfReport){ context = context+ "<a target='_blank' class='icon-link' style='background-image:url(../admin/images/pdficon.gif);' href=\"../report" + "?" +"reportDataSession="+ reportDataSession + "&component=" + component + "&template=" + template + "&type=pdf" + "\">Generate Pdf Report</a>"; } if(htmlReport){ context = context+ "<a target='_blank' class='icon-link' style='background-image:url(../admin/images/htmlicon.gif);' href=\"../report" + "?" + "reportDataSession="+ reportDataSession + "&component=" + component + "&template=" + template + "&type=html" + "\">Generate Html Report</a>"; } if(excelReport){ context = context+ "<a target='_blank' class='icon-link' style='background-image:url(../admin/images/excelicon.gif);' href=\"../report" + "?" + "reportDataSession="+ reportDataSession + "&component=" + component + "&template=" + template + "&type=excel" +"\">Generate Excel Report</a>"; } context = context + "</div><div style='clear:both;'></div>"; try { writer.write(context); } catch (IOException e) { String msg = "Cannot write reporting tag content"; throw new JspException(msg, e); } return EVAL_PAGE; }
Example 8
Source File: AbstractBaseTag.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Handle Exception * * @param e * @throws JspException */ protected void __handleException( Exception e ) throws JspException { JspWriter writer = pageContext.getOut( ); try { writer.write( "<font color='red'>" ); //$NON-NLS-1$ writer.write( e.getMessage( ) ); writer.write( "</font>" ); //$NON-NLS-1$ } catch ( IOException err ) { throw new JspException( err ); } }
Example 9
Source File: BirtTagUtil.java From birt with Eclipse Public License 1.0 | 5 votes |
public static void writeExtScript(JspWriter writer, String fileName ) throws IOException { writer .write( "<script src=\"" //$NON-NLS-1$ + fileName + "\" type=\"text/javascript\"></script>\n" ); //$NON-NLS-1$ }
Example 10
Source File: ParamDefTag.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * Handle Exception * * @param e * @throws JspException */ protected void __handleException( Exception e ) throws JspException { JspWriter writer = pageContext.getOut( ); try { writer.write( "<font color='red'>" ); //$NON-NLS-1$ writer.write( e.getMessage( ) ); writer.write( "</font>" ); //$NON-NLS-1$ } catch ( IOException err ) { throw new JspException( err ); } }
Example 11
Source File: QuickFinderRenderer.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Renders the quick finder to the page context * @see org.kuali.kfs.sys.document.web.renderers.Renderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag, org.kuali.rice.krad.bo.BusinessObject) */ public void render(PageContext pageContext, Tag parentTag) throws JspException { JspWriter out = pageContext.getOut(); try { out.write(buildQuickFinderHtml(pageContext)); } catch (IOException ioe) { throw new JspException("Cannot render quick finder for field "+getField(), ioe); } }
Example 12
Source File: DynamicReadOnlyRender.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * @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 { JspWriter out = pageContext.getOut(); try { String value = discoverRenderValue(); out.write(buildBeginSpan()); if (!StringUtils.isEmpty(value)) { if (shouldRenderInquiryLink()) { out.write(buildBeginInquiryLink()); } out.write(value); if (shouldRenderInquiryLink()) { out.write(buildEndInquiryLink()); } } else { out.write(buildNonBreakingSpace()); } out.write(buildEndSpan()); renderShadowInputTag(pageContext, parentTag); } catch (IOException ioe) { throw new JspException("Difficulty rendering read only field", ioe); } }
Example 13
Source File: SubmittedTag.java From spacewalk with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public int doEndTag() throws JspException { HtmlTag input = new HtmlTag("input"); input.setAttribute("type", HIDDEN); input.setAttribute("name", RhnAction.SUBMITTED); input.setAttribute("value", TRUE); JspWriter writer = pageContext.getOut(); try { writer.write(input.render()); } catch (IOException e) { throw new JspException(e); } return SKIP_BODY; }
Example 14
Source File: SubmittedTag.java From uyuni with GNU General Public License v2.0 | 5 votes |
/** * {@inheritDoc} */ public int doEndTag() throws JspException { HtmlTag input = new HtmlTag("input"); input.setAttribute("type", HIDDEN); input.setAttribute("name", RhnAction.SUBMITTED); input.setAttribute("value", TRUE); JspWriter writer = pageContext.getOut(); try { writer.write(input.render()); } catch (IOException e) { throw new JspException(e); } return SKIP_BODY; }
Example 15
Source File: TableRenderer.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * * @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 { JspWriter out = pageContext.getOut(); try { out.write(buildBeginningTableTag()); table.renderChildrenRows(pageContext, parentTag); out.write(buildEndingTableTag()); } catch (IOException ioe) { throw new JspException("Difficulty with rendering inner table", ioe); } }
Example 16
Source File: DateRenderer.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * * @see org.kuali.kfs.sys.document.web.renderers.TextRenderer#render(javax.servlet.jsp.PageContext, javax.servlet.jsp.tagext.Tag, org.kuali.rice.krad.bo.BusinessObject) */ @Override public void render(PageContext pageContext, Tag parentTag) throws JspException { super.render(pageContext, parentTag); JspWriter out = pageContext.getOut(); try { out.write(buildDateImage()); out.write(buildDateJavascript()); } catch (IOException ioe) { throw new JspException("Difficulty rendering date picker", ioe); } }
Example 17
Source File: Out.java From Tomcat8-Source-Read with MIT License | 5 votes |
public static boolean output(JspWriter out, Object input, String value, String defaultValue, boolean escapeXml) throws IOException { if (input instanceof Reader) { char[] buffer = new char[8096]; int read = 0; while (read != -1) { read = ((Reader) input).read(buffer); if (read != -1) { if (escapeXml) { String escaped = Util.escapeXml(buffer, read); if (escaped == null) { out.write(buffer, 0, read); } else { out.print(escaped); } } else { out.write(buffer, 0, read); } } } return true; } else { String v = value != null ? value : defaultValue; if (v != null) { if(escapeXml){ v = Util.escapeXml(v); } out.write(v); return true; } else { return false; } } }
Example 18
Source File: GroupTotalRenderer.java From kfs with GNU Affero General Public License v3.0 | 4 votes |
/** * Uses a Struts write tag to dump out the total * @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 { JspWriter out = pageContext.getOut(); try { out.write("<tr>"); final int emptyCellSpanBefore = this.getColumnNumberOfRepresentedCell() - 1; out.write("<td class=\"total-line\" colspan=\""); out.write(Integer.toString(emptyCellSpanBefore)); out.write("\"> </td>"); out.write("<td class=\"total-line\" style=\"border-left: 0px;\">"); out.write("<strong>"); out.write(SpringContext.getBean(ConfigurationService.class).getPropertyValueAsString(totalLabelProperty)); out.write(" "); writeTag.setPageContext(pageContext); writeTag.setParent(parentTag); writeTag.setProperty(getTotalProperty()); writeTag.doStartTag(); writeTag.doEndTag(); out.write("</strong>"); out.write("</td>"); final int emptyCellSpanAfter = this.getCellCount() - this.getColumnNumberOfRepresentedCell(); if(emptyCellSpanAfter > 0) { out.write("<td class=\"total-line\" style=\"border-left: 0px;\" colspan=\""); out.write(Integer.toString(emptyCellSpanAfter)); out.write("\"> </td>"); } out.write("</tr>"); } catch (IOException ioe) { throw new JspException("Difficulty rendering group total", ioe); } }
Example 19
Source File: PluginListTag.java From ontopia with Apache License 2.0 | 4 votes |
/** * Process the start tag for this instance. */ @Override public int doStartTag() throws JspTagException { ContextTag contextTag = FrameworkUtils.getContextTag(pageContext); if (contextTag == null) throw new JspTagException("The framework:pluginList tag can only be used " + "inside the context tag"); try { JspWriter out = pageContext.getOut(); Iterator it = contextTag.getNavigatorConfiguration() .getPlugins(groupId).iterator(); PluginIF plugin; String html; boolean isFirst = true; // loop over all activated plugins and let them generate html while (it.hasNext()) { plugin = (PluginIF) it.next(); // if this plugin should be excluded than go to next one if (excludePluginId != null && excludePluginId.equals(plugin.getId())) continue; // if activated then generate HTML if (plugin.getState() == PluginIF.ACTIVATED) { html = plugin.generateHTML(contextTag); if (html != null) { // don't put out separator first time and last time if (!isFirst || preSeparatorFlag) out.write(separator); if (plugin instanceof IncludePluginIF) pageContext.include(html); else out.write(html); isFirst = false; } } } // while it } catch (ServletException sr) { throw JSPEngineWrapper.getJspTagException("Error in PluginListTag", sr); } catch (IOException ioe) { throw JSPEngineWrapper.getJspTagException("Error in PluginListTag", ioe); } // empty tag has not to eval anything return SKIP_BODY; }
Example 20
Source File: EgovComCrossSiteHndlr.java From oslits with GNU General Public License v3.0 | 3 votes |
public static void out2(PageContext pageContext, boolean escapeXml, Object obj) throws IOException { JspWriter w = pageContext.getOut(); w.write(obj.toString()); }