List of usage examples for javax.servlet.jsp JspWriter println
abstract public void println(Object x) throws IOException;
From source file:com.feilong.taglib.AbstractWriteContentTag.java
/** * ?./*w w w. j a v a2 s . c om*/ * * @param object * the object * @since 1.5.3 move from {@link BaseTag} */ protected void println(Object object) { JspWriter jspWriter = pageContext.getOut(); try { jspWriter.println(object.toString()); } catch (IOException e) { throw new UncheckedIOException(e); } }
From source file:org.squale.welcom.taglib.security.CheckPageTag.java
/** * @see javax.servlet.jsp.tagext.TagSupport#doEndTag() *//*from ww w . j a v a 2 s . co m*/ public int doEndTag() throws JspException { boolean valid = false; final HttpSession session = super.pageContext.getSession(); // if(session != null && session.getAttribute(name) != null) if (session != null) { valid = true; } if (valid) { computeMode(); return EVAL_PAGE; } try { session.invalidate(); final JspWriter out = super.pageContext.getOut(); out.println( "<html><body><table class=\"wide\"><tr><td bgcolor=\"#e0e0e0\"><tr><td><table class=\"wide\"><tr><td align=\"center\" bgcolor=\"#cacaca\">" + "<font face=\"Arial, Helvetica, sans-serif\"><b>Erreurs</b></font></td></tr><tr><td class=\"boxtext\" bgcolor=\"#dae6e6\"> - " + "<a href=\"/index.jsp\">Session invalid\351e</a></td></tr></table></td></tr></table></body></html>"); } catch (final Exception e) { log.error(e, e); throw new JspException(e.toString()); } return SKIP_PAGE; }
From source file:org.webcurator.ui.common.taglib.HarvestResultChain.java
public void doIt(int ix) throws JspException, IOException { JspWriter writer = pageContext.getOut(); HarvestResult result = chain.get(ix); writer.println("<wct:HarvestResult>"); writer.print("<wct:Creator>"); writer.print(/* www.j a v a 2s. c o m*/ StringEscapeUtils.escapeXml(result.getCreatedBy().getUsername()) + " " + ix + "/" + chain.size()); writer.println("</wct:Creator>"); writer.print("<wct:CreationDate>"); writer.print(dateFormatter.format(result.getCreationDate())); writer.println("</wct:CreationDate>"); writer.print("<wct:ProvenanceNote>"); writer.print(StringEscapeUtils.escapeXml(result.getProvenanceNote())); writer.println("</wct:ProvenanceNote>"); if (!result.getModificationNotes().isEmpty()) { writer.println("<wct:ModificationNotes>"); for (String note : result.getModificationNotes()) { writer.print("<wct:ModificationNote>"); writer.print(StringEscapeUtils.escapeXml(note)); writer.println("</wct:ModificationNote>"); } writer.println("</wct:ModificationNotes>"); } if ((ix + 1) < chain.size()) { writer.println("<wct:DerivedFrom>"); doIt(ix + 1); writer.println("</wct:DerivedFrom>"); } writer.println("</wct:HarvestResult>"); }
From source file:org.broadleafcommerce.core.web.catalog.taglib.CategoryBreadCrumbTag.java
@Override public void doTag() throws JspException, IOException { if (categoryId == null && categoryList == null) { throw new RuntimeException("Either categoryId or categoryList is required for this tag"); }/*from ww w. j av a2 s .c o m*/ if (categoryId != null) { Category category = this.getCatalogService().findCategoryById(categoryId); if (category == null && LOG.isDebugEnabled()) { LOG.debug("The category returned was null for categoryId: " + categoryId); } while (category != null) { categoryList.add(category); category = category.getDefaultParentCategory(); } Collections.reverse(categoryList); } JspWriter out = getJspContext().getOut(); int count = 0; for (Category cat : categoryList) { out.println(getUrl(cat)); if (count < categoryList.size() - 1) { out.println(" > "); } ++count; } }
From source file:org.shredzone.cilla.web.header.HeaderFragmentRenderer.java
/** * Renders {@link MetaTag} only.// w w w . j a v a2 s . c om */ @Fragment(name = "meta") public void metaFragment(ServletRequest req, JspWriter out) throws IOException { DocumentHeader header = documentHeaderManager.getDocumentHeader(); for (MetaTag meta : header.getMetaTags()) { out.println(meta.toString()); } }
From source file:org.shredzone.cilla.web.header.HeaderFragmentRenderer.java
/** * Renders {@link HeadTag}, except of {@link MetaTag}. *//*from www . jav a 2s .co m*/ @Fragment(name = "header") public void headerFragment(ServletRequest req, JspWriter out) throws IOException { DocumentHeader header = documentHeaderManager.getDocumentHeader(); for (HeadTag head : header.getHeadTags()) { out.println(head.toString()); } }
From source file:de.u808.simpleinquest.web.tags.MimeIconTag.java
@Override public void doTag() throws JspException, IOException { if (this.mimeIconRegistry == null) { this.initMimeIconRegistry(); }//www . j a v a 2 s . c om PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); try { if (StringUtils.isNotEmpty(filename)) { String iconURI = mimeIconRegistry.getMimeIcon(filename); out.println("<img src=\"" + iconURI + "\" alt=\"Letzte Seite\"/>"); } } catch (Exception e) { log.error("Tag error", e); } }
From source file:dk.netarkivet.archive.webinterface.BitpreserveFileState.java
/** * Print HTML formatted state for missing files on a given replica in a given locale. * * @param out The writer to write state to. * @param replica The replica to write state for. * @param locale The locale to write state in. * @throws IOException On IO trouble writing state to the writer. *///from ww w. j av a2 s.c o m public static void printMissingFileStateForReplica(JspWriter out, Replica replica, Locale locale) throws IOException { ArgumentNotValid.checkNotNull(out, "JspWriter out"); ArgumentNotValid.checkNotNull(replica, "Replica replica"); ArgumentNotValid.checkNotNull(locale, "Locale locale"); ActiveBitPreservation activeBitPreservation = ActiveBitPreservationFactory.getInstance(); //element id's final String replicaName = replica.getName(); final String numberId = replicaName + "_number"; final String missingId = replicaName + "_missing"; final String updatedId = replicaName + "_updated"; //Header out.println(I18N.getString(locale, "filestatus.for") + " <b>" + HTMLUtils.escapeHtmlValues(replicaName) + "</b>"); out.println("<br/>"); // Number of files, and number of files missing out.println(I18N.getString(locale, "number.of.files") + " <span id=\"" + numberId + "\">" + HTMLUtils.localiseLong(activeBitPreservation.getNumberOfFiles(replica), locale) + "</span>"); out.println("<br/>"); long numberOfMissingFiles = activeBitPreservation.getNumberOfMissingFiles(replica); out.println(I18N.getString(locale, "missing.files") + " <span id=\"" + missingId + "\">" + HTMLUtils.localiseLong(numberOfMissingFiles, locale) + "</span>"); if (numberOfMissingFiles > 0) { out.print(" <a href=\"" + Constants.FILESTATUS_MISSING_PAGE + "?" + (Constants.BITARCHIVE_NAME_PARAM + "=" + HTMLUtils.encodeAndEscapeHTML(replicaName)) + " \">"); out.print(I18N.getString(locale, "show.missing.files")); out.print("</a>"); } out.println("<br/>"); Date lastMissingFilesupdate = activeBitPreservation.getDateForMissingFiles(replica); if (lastMissingFilesupdate == null) { lastMissingFilesupdate = new Date(0); } out.println("<span id=\"" + updatedId + "\">" + I18N.getString(locale, "last.update.at.0", lastMissingFilesupdate) + "</span>"); out.println("<br/>"); out.println("<a href=\"" + Constants.FILESTATUS_UPDATE_PAGE + "?" + Constants.UPDATE_TYPE_PARAM + "=" + Constants.FIND_MISSING_FILES_OPTION + "&" + (Constants.BITARCHIVE_NAME_PARAM + "=" + HTMLUtils.encodeAndEscapeHTML(replicaName)) + "\">" + I18N.getString(locale, "update.filestatus.for.0", replica.getId()) + "</a>"); out.println("<br/><br/>"); }
From source file:fll.web.scoreEntry.ScoreEntry.java
/** * Generate an increment or decrement button for goal name with * increment/decrement increment.//from w w w . j a va2s . com */ private static void generateIncDecButton(final String name, final int increment, final JspWriter writer) throws IOException { // generate buttons with calls to increment<name> final String buttonName = (increment < 0 ? "" : "+") + String.valueOf(increment); final String buttonID = getIncDecButtonID(name, increment); writer.println(" <td>"); writer.println(" <input id='" + buttonID + "' type='button' value='" + buttonName + "' onclick='" + getIncrementMethodName(name) + "(" + increment + ")'>"); writer.println(" </td>"); }
From source file:org.openmrs.module.mdrtb.web.taglib.FormatTag.java
/** * @see Tag#doStartTag()/* w ww . j a v a 2 s .com*/ */ @SuppressWarnings("unchecked") public int doStartTag() throws JspException { String ret = (ObjectUtil.notNull(defaultVal) ? MessageUtil.translate(defaultVal) : ""); if (obj != null) { if (obj instanceof Collection<?>) { Collection<?> l = (Collection<?>) obj; if (!l.isEmpty()) { Object o = l.iterator().next(); if (o instanceof Concept) { ret = RegimenUtils.formatConcepts((Collection<Concept>) l, separator, defaultVal); } else if (o instanceof DrugOrder) { ret = RegimenUtils.formatDrugOrders(((Collection<DrugOrder>) l), separator, defaultVal); } else { List<String> s = new ArrayList<String>(); for (Object item : l) { s.add(formatObject(item)); } ret = OpenmrsUtil.join(s, separator); } } } else { ret = formatObject(obj); } } try { if (ret != null) { JspWriter w = pageContext.getOut(); w.println(ret); } } catch (IOException ex) { log.error("Error while starting duration tag", ex); } return SKIP_BODY; }