You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by K Br <ko...@ny.com> on 2002/03/08 00:29:14 UTC

Processing BodyContent in doAfterTag() has no effect

This is no JSP forum and I understand that.
I would appreciate any pointers on this.

Using Tomcat4.0.2 I have written a custom tag with body.
The intention is to process the body and
replace any periods with line breaks (in HTML)
before writing the BodyContent to the
enclosing JspWriter.

It seems that replacing "." with ".<br>" does not
take any effect. The output HTML does not contain
the <br> tags (when viewed from the browser).

>From the doAfterBody() I call the filter
to replace the periods with <br> as follows.

Pl let me know if my understanding of the
TAG lifecycle is wrong:

public int doAfterBody() throws JspException {
try {
String txt = getBodyContent().getString();
replaceDots(txt.toLowerCase()
getPreviousOut()
);
}
catch (java.io.IOException ioxc) {
throw new JspException(ioxc.toString());
}

return SKIP_BODY;
}

private void replaceDots(final String x, JspWriter w)
throws java.io.IOException
{
if (x == null) return ;
StringTokenizer st = new StringTokenizer(x, ".");
while (st.hasMoreTokens()) {
String f = (String)st.nextToken();
w.println( f.equals(".") ? ".<br>":f);
}
}



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>