/** * Invokes tag body. */ public static void invokeBody(final JspFragment body) throws JspException { if (body == null) { return; } try { body.invoke(null); } catch (IOException ioex) { throw new JspException("Tag body failed", ioex); } }
@Override public void doTag() throws JspException, IOException { StringWriter writer = new StringWriter(); getJspBody().invoke(writer); String serverName = context.getRequest().getServerName(); if ("localhost".equals(serverName)) { getJspBody().getJspContext().getOut().write(urlString); return; urlString += anchor; getJspBody().getJspContext().getOut().write(urlString);
Writer out = body.getJspContext().getOut(); for (JSOG item : items.arrayIterable()) { getJspContext().setAttribute(var, item); body.invoke(out); for (Entry<String, JSOG> entry : items.objectIterable()) { getJspContext().setAttribute(var, entry); body.invoke(out);
/** * Invokes tag body to provided writer. */ public static void invokeBody(final JspFragment body, final Writer writer) throws JspException { if (body == null) { return; } try { body.invoke(writer); } catch (IOException ioex) { throw new JspException("Tag body failed", ioex); } }
@Override public void evaluate(Writer writer) throws IOException { if (jspFragment == null) { return; } try { jspFragment.invoke(writer); } catch (JspException e) { throw new IOException("JspException when evaluating the body", e); } }
public static String getBodyResult(JspFragment jspBody) throws IOException, JspException { if (jspBody == null) { return ""; } StringWriter writer = new StringWriter(); jspBody.invoke(writer); return writer.toString(); }
public static String getBody(JspFragment fragment) throws JspException, IOException { if (fragment == null) return ""; StringWriter body = new StringWriter(); fragment.invoke(body); body.close(); return body.toString().trim(); }
JspFragment body = getJspBody(); StringWriter stringWriter = new StringWriter(); StringBuffer buff = stringWriter.getBuffer(); buff.append("<h1>"); body.invoke(stringWriter); buff.append("</h1>"); out.println(stringWriter);
protected void doBody() throws JspException, IOException { final JspFragment body = getJspBody(); if (body != null) { body.invoke(null); } }
public void doTag() throws JspException, IOException { String formatted = new SimpleDateFormat("long".equals(format)?"EEE 'the' d:MMM:yyyy":"d:MM:yy") .format(new Date()); StringTokenizer tok = new StringTokenizer(formatted,":"); JspContext context = getJspContext(); context.setAttribute("day", tok.nextToken() ); context.setAttribute("month", tok.nextToken() ); context.setAttribute("year", tok.nextToken() ); JspFragment fragment = getJspBody(); fragment.invoke(null); } }
public void render(Writer writer) throws IOException, JspException { if (getJspBody() != null) { getJspBody().invoke(writer); } }
public void doTag() throws JspException, IOException { JspFragment body = getJspBody(); if (body != null) { StringWriter sw = new StringWriter(); body.invoke(sw); value = sw.toString(); } JspTag parent = getParent(); if (parent != null && parent instanceof ParametrizedTag) { ParametrizedTag pt = (ParametrizedTag) parent; pt.setParamValue(name, value); } else { throw new JspException("<param> tag can occur only within <url> tag"); } }
/** * * if this "attribute" represents a event Add self contents to parent's dynamic attribute. * * */ public void doTag() throws JspException, IOException { if(!isEffective()) return; StringWriter out = new StringWriter(); getJspBody().invoke(out); String outStr = trim ? out.toString().trim() : out.toString(); try {//because parent is a BranchTag, evaluate its attribute. if(_name.startsWith("on")) _parent.setDynamicAttribute(null, _name, outStr); else BranchTag.evaluateDynaAttribute(_parent.getComponent(), _name, outStr); } catch (ModificationException e) { throw new JspException(e); } catch (NoSuchMethodException e) { throw new JspException(e); } }
@Override public void doTag() throws JspException { try { Integer actualCode = (Integer)getJspContext().findAttribute("javax.servlet.error.status_code"); actualCode =(actualCode == null) ? 0 : actualCode; if (errorCode == actualCode) { // We are looking at the expected error code. JspFragment body = getJspBody(); body.invoke(null); } } catch (Exception ex) { throw new JspException("Exception executing tag", ex); } } }
/** * {@inheritDoc} */ @Override public void doTag() throws JspException, IOException { final ParamParent parent = (ParamParent) findAncestorWithClass(this, ParamParent.class); if (parent == null) { throw new JspException(format("ECUB1004")); } final String value; if (this.value == null) { final StringWriter writer = new StringWriter(); getJspBody().invoke(writer); value = writer.toString().trim(); } else { value = this.value; } parent.addParameter(name, value); }
@Override public void doTag() throws JspException, IOException { JspWriter out = getJspContext().getOut(); StringWriter stringWriter = new StringWriter(); getJspBody().invoke(stringWriter); String highlightedValue = doHighlight(stringWriter.toString()); out.print(highlightedValue); }
public void doTag() throws JspException, IOException { if (JspSupport.hasErrors((PageContext) getJspContext())) { return; } JspFragment f = getJspBody(); if (f != null) { f.invoke(null); } }
@Override public void doTag() throws JspException, IOException { PageContext pageContext = (PageContext) getJspContext(); JspWriter out = pageContext.getOut(); StringWriter sw = new StringWriter(); sw.append("<a href=\"").append(getApplicationDomain()).append("openid/v2/signin?token_url=").append(URLEncoderUtils.encode(getTokenUrl())).append("\" "); sw.append("class=\"rpxnow"); if (getStyleClass() != null && getStyleClass().length() > 0) { sw.append(" ").append(getStyleClass()); } sw.append("\" "); sw.append("onclick=\"return false;\""); if (getStyle() != null && getStyle().length() > 0) { sw.append(" style=\"").append(getStyle()).append("\""); } sw.append(">"); JspFragment body = getJspBody(); if (body != null) { body.invoke(sw); } sw.append("</a>"); out.print(sw.toString()); }
public void doTag() throws JspException, IOException { if (!JspSupport.hasErrors((PageContext) getJspContext())) { return; } JspFragment f = getJspBody(); if (f != null) { f.invoke(null); } }