List of usage examples for javax.servlet.jsp JspWriter print
abstract public void print(Object obj) throws IOException;
From source file:net.mlw.vlh.web.util.JspUtils.java
/** * Write the specified text as the response to the writer associated with * this page. <strong>WARNING </strong>- If you are writing body content from * the <code>doAfterBody()</code> method of a custom tag class that * implements <code>BodyTag</code>, you should be calling * <code>writePrevious()</code> instead. * /*from w w w .ja v a 2 s. c om*/ * @param pageContext * The PageContext object for this page * @param text * The text to be written * * @exception JspException * if an input/output error occurs */ public static void write(PageContext pageContext, String text) throws JspException { JspWriter writer = pageContext.getOut(); try { writer.print(text); } catch (IOException e) { LOGGER.error("JspUtils.write() exception...", e); throw new JspException(e); } }
From source file:jp.terasoluna.fw.web.taglib.TagUtil.java
/** * PageContextJspWriter?AweLXg?o?B/*from ww w . j av a 2 s . c o m*/ * ?s?B * * @param pageContext y?[WReLXg * @param text ?oeLXg * @throws JspException * I/OG?[???IOExceptionbvO */ public static void write(PageContext pageContext, String text) throws JspException { JspWriter writer = pageContext.getOut(); try { writer.print(text); } catch (IOException e) { throw new JspException(e); } }
From source file:net.mlw.vlh.web.util.JspUtils.java
/** * Write the specified text as the response to the writer associated with the * body content for the tag within which we are currently nested. * //from w w w . j a v a 2 s . c o m * @param pageContext * The PageContext object for this page * @param text * The text to be written * * @exception JspException * if an input/output error occurs */ public static void writePrevious(PageContext pageContext, String text) throws JspException { JspWriter writer = pageContext.getOut(); if (writer instanceof BodyContent) { writer = ((BodyContent) writer).getEnclosingWriter(); } try { writer.print(text); } catch (IOException e) { LOGGER.error("JspUtils.writePrevious() exception...", e); throw new JspException(e); } }
From source file:de.iteratec.iteraplan.presentation.tags.TagUtils.java
public static void insertImage(PageContext ctx, String image, int width, int height) throws IOException { JspWriter w = ctx.getOut(); String alt = ""; w.print("<img src=\""); w.print(ctx.getServletContext().getContextPath()); w.print(image);/*from w ww. ja v a2s. c om*/ w.println("\" style=\"float: right;\" width=\"" + width + "\" height=\"" + height + "\" alt=\"" + alt + "\" />"); }
From source file:de.iteratec.iteraplan.presentation.tags.TagUtils.java
/** * Write the specified text as the response to the writer associated with this page. * // w ww . java 2 s . c om * @param pageContext * The PageContext object for this page * @param text * The text to be written * @throws JspException * if an input/output error occurs */ public static void write(PageContext pageContext, String text) throws JspException { JspWriter writer = pageContext.getOut(); try { writer.print(text); } catch (IOException e) { throw new JspException("An I/O error ocurred: ", e); } }
From source file:com.day.cq.wcm.foundation.forms.ValidationHelper.java
/** * Write java script client code for a regexp. * @deprecated Use {@link FieldHelper#writeClientRegexpText(SlingHttpServletRequest, SlingHttpServletResponse, FieldDescription, String)} */// www .java 2s. c o m @Deprecated public static void writeRegexpText(final SlingHttpServletRequest request, final Resource resource, final String regexp, final JspWriter out) throws IOException { final String id = ValidationHelper.getFormElementQualifier(request, resource); final String name = FormsHelper.getParameterName(resource); out.println("{ var result=false;"); out.print("var pattern = "); out.print(regexp); out.print("; var t = pattern.exec("); out.print(id); out.print(".value);"); out.println("if (t) {"); out.println("var len = "); out.print(id); out.print(".value.length;"); out.println("var pattlen = t[0].length;"); out.println("result = (pattlen == len); "); out.println("}"); out.println("if ( !result ) {"); out.print("cq5forms_showMsg('"); out.print(StringEscapeUtils.escapeEcmaScript(FormsHelper.getFormId(request))); out.print("','"); out.print(StringEscapeUtils.escapeEcmaScript(name)); out.print("','"); out.print(StringEscapeUtils.escapeEcmaScript(ValidationHelper.getConstraintMessage(resource))); out.print("');"); out.println("return false; } }"); }
From source file:com.day.cq.wcm.foundation.forms.ValidationHelper.java
/** * Write java script client code for a required check. * @deprecated Use {@link FieldHelper#writeClientRequiredCheck(SlingHttpServletRequest, SlingHttpServletResponse, FieldDescription)} *//*from w w w . j a v a 2s.c o m*/ @Deprecated public static void writeRequiredCheck(final SlingHttpServletRequest request, final Resource resource, final JspWriter out) throws IOException { final String formId = FormsHelper.getFormId(request); final String name = FormsHelper.getParameterName(resource); if (FormsHelper.isRequired(resource)) { final String qualifier = getFormElementQualifier(request, resource); out.print("if (cq5forms_isEmpty("); out.print(qualifier); out.print(")) {cq5forms_showMsg('"); out.print(StringEscapeUtils.escapeEcmaScript(formId)); out.print("','"); out.print(StringEscapeUtils.escapeEcmaScript(name)); out.print("','"); out.print(StringEscapeUtils.escapeEcmaScript(ValidationHelper.getRequiredMessage(resource))); out.println("'); return false; }"); } }
From source file:dk.netarkivet.archive.webinterface.BitpreserveFileState.java
/** * Print a table row with current state of a file in admin data. * * @param out The stream to print state to. * @param fs The file preservation state for that file. * @param locale Locale of the labels.//from w w w. j a v a 2 s .c om * @throws IOException on trouble printing the state. */ private static void printFileStateForAdminData(JspWriter out, PreservationState fs, Locale locale) throws IOException { out.print(HTMLUtils.makeTableRow(HTMLUtils.makeTableElement(I18N.getString(locale, "admin.data")), HTMLUtils.makeTableElement("-"), HTMLUtils.makeTableElement(fs.getAdminChecksum()))); }
From source file:com.day.cq.wcm.foundation.forms.ValidationHelper.java
/** * Write java script client code for a constraint check. * @deprecated Use {@link FieldHelper#writeClientConstraintCheck(SlingHttpServletRequest, SlingHttpServletResponse, FieldDescription)} *//*from w ww. ja v a 2s . co m*/ @Deprecated public static void writeConstraintCheck(final SlingHttpServletRequest request, final SlingHttpServletResponse response, final Resource resource, final JspWriter out) throws IOException, ServletException { final ValueMap properties = ResourceUtil.getValueMap(resource); // additional constraint? final String constraint = properties.get(FormsConstants.ELEMENT_PROPERTY_CONSTRAINT_TYPE, ""); if (constraint.length() > 0) { final String qualifier = getFormElementQualifier(request, resource); out.print("if (!cq5forms_isEmpty("); out.print(qualifier); out.print(")){"); String rt = constraint; if (constraint.indexOf('/') == -1) { rt = FormsConstants.RT_FORM_CONSTRAINT + "s/" + rt; } final Resource includeResource = new ResourceWrapper(resource, rt, FormsConstants.RST_FORM_CONSTRAINT); FormsHelper.includeResource(request, new JspSlingHttpServletResponseWrapper(response, out), includeResource, FormsConstants.SCRIPT_CLIENT_VALIDATION); out.print("}"); } }
From source file:org.apache.hadoop.mapred.JSPUtil.java
private static void printJobACLsInternal(Map<JobACL, AccessControlList> jobAcls, JspWriter out) throws IOException { // Display job-view-acls and job-modify-acls configured for this job out.print("<b>Job-ACLs:</b><br>"); for (JobACL aclName : JobACL.values()) { String aclConfigName = aclName.getAclName(); AccessControlList aclConfigured = jobAcls.get(aclName); if (aclConfigured != null) { String aclStr = aclConfigured.toString(); out.print(" " + aclConfigName + ": " + aclStr + "<br>"); }//from w w w . j a v a 2 s .c o m } }