This is an issue that is not specific to Jakarta Taglibraries, but I
cannot find a relevant location to deal with issues that seem to arise
with different versions of Tomcat and the Implementation of Custom
Taglibraries. (If anyone can recommend a better list to discuss this on
please tell me.
I've got a custom tag that implements a TryCatchFinally interface, its
relatively simple and mirrors the behavior of the Catch tag in JSTL. My
problem is that with the latest version of Tomcat (4.1.12). I am getting
a null BodyContent object from this.getBodyContent(); in the
doAfterBody() method, can anyone tell me why this would be happening?
I don't understand when, where and why BodyContent could end up Null...
Any advice would be helpfull. I've been trying to migrate my
taglibraries (including my new JNDI taglibrary that I was going to
donate to Apache as a "Sandbox" taglibrary). But first I need to get
them upgraded and running properly and this BodyContent issue has been a
major flaw this week.
Tag Class:
package edu.harvard.hmdc.taglib.conditional;
import javax.servlet.jsp.tagext.Tag;
import javax.servlet.jsp.tagext.IterationTag;
import javax.servlet.jsp.tagext.BodyTag;
import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.tagext.BodyTagSupport;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.ServletRequest;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Generated tag class.
*/
public class TestTag extends BodyTagSupport implements
javax.servlet.jsp.tagext.TryCatchFinally{
/** Log object for this class. */
private Log log = null;
public TestTag() {
super();
log = LogFactory.getLog(this.getClass());
log.debug("log enabled in Get Tag");
}
public int doStartTag() throws JspException, JspException {
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException, JspException {
return EVAL_PAGE;
}
public int doAfterBody() throws JspException {
try {
BodyContent bodyContent = getBodyContent();
JspWriter out = bodyContent.getEnclosingWriter();
bodyContent.writeOut(out);
bodyContent.clearBody();
} catch (IOException ex) {
log.error(ex.getMessage(),ex);
}
return SKIP_BODY;
}
public void doCatch(Throwable t) throws Throwable {
log.debug("doCatch(Throwable t)");
log.debug("t="+t.getClass().getName());
//throw t;
}
public void doFinally() {
log.debug("doFinally()");
}
}
JSP Example:
<cond:test>
<!-- test content -->
<%
if(request.getParameter("throw") != null){
throw new java.lang.Exception("Message from Exception");
}
%>
Successfully completed test block without exception.
</cond:test>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
- Re: Stuck in Mud... Need your help... Mark R. Diggory
- Re: Stuck in Mud... Need your help... Mark R. Diggory
- Re: Stuck in Mud... Need your help... Christopher Lenz
- Re: Stuck in Mud... Need your help... Mark R. Diggory
- RE: Stuck in Mud... Need your help... Jim Henderson
- Re: Stuck in Mud... Need your help... Mark R. Diggory
- RE: Stuck in Mud... Need your help... Karr, David
- [OT reply to] Re: Stuck in Mud... Need your help... Mark R. Diggory