You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by bc...@mail.liberty.k12.mo.us on 2001/10/10 23:38:36 UTC

BodyTagSupport in catalina

i had been running tomcat 3.2, and had several tag libraries and several 
tags that extended BodyTagSupport.  they don't work anymore in tomcat 
4.  they throw a NullPointerException.  the basic structure is this:

public class classname extends BodyTagSupport
{
	public int doStartTag()
	{
		return EVAL_BODY_INCLUDE;
	}

	public int doAfterBody()
	{
		BodyContent body = getBodyContent();
		JspWriter out = body.getEnclosingWriter();

		try
		{
			out.println(body.getString().trim());
		}
		catch (NullPointerException e)
		{
		}
		return SKIP_BODY;
	}
}

it seems to be throwing the NullPointerException at the JspWriter out = 
body.getEnclosingWriter() line.  when i enclose all of doAfterBody in a 
try-catch NullPointerException block, it works fine, but i shouldn't 
have to do that, should i?  i tried using getPreviousOut() instead (i 
got that from the jsp 1.2 docs), but then it wouldn't compile at all.

thanks,
ben