tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Rabe <dr...@opentext.com>
Subject Taglib lifecycle issues
Date Thu, 19 Jun 2003 23:20:47 GMT
I'm using Tomcat 4.1.24-LE-jdk14, and have written a simple taglib by
extending the TagSupport class. It basically works, but the lifecycle is
being handled differently than I expected. My tag has no body, and has one
required attribute. My JSP page contains several invocations, all with
different values for the attribute. I expected setPageContext() to be called
once, followed by a bunch of doStartTag() / doEndTag() calls, followed by
one release() call. Instead, setPageContext() is being called for each
invocation of my tag (followed by doStartTag() and doEndTag()). My release()
method is *never* called.

I'm basing my expectations on the JSP 1.2 spec, esp pp. 163-164, and the
discussion about "Tag handler life cycle and instance reuse" at
http://www.onjava.com/pub/a/onjava/2001/11/07/jsp12.html?page=2.

The two issues in my mind are: (a) Is this working according to spec?
Perhaps I misunderstood how it's supposed to work. and (b) Could this be
done more efficiently? Replacing several scriptlet method calls with a
taglib caused the JSP's class file to double in size.

The code that's being generated for the JSP includes a bunch of private
methods that look like this:
  private boolean _jspx_meth_xlate_get_61(javax.servlet.jsp.PageContext
pageContext)
          throws Throwable {
    JspWriter out = pageContext.getOut();
    /* ----  xlate:get ---- */
    com.eloquent.ecs.tags.xlate.EXlateTagGet _jspx_th_xlate_get_61 =
(com.eloquent.ecs.tags.xlate.EXlateTagGet)
_jspx_tagPool_xlate_get_key.get(com.eloquent.ecs.tags.xlate.EXlateTagGet.cla
ss);
    _jspx_th_xlate_get_61.setPageContext(pageContext);
    _jspx_th_xlate_get_61.setParent(null);
    _jspx_th_xlate_get_61.setKey("jsp.edownloadplayer.File");
    int _jspx_eval_xlate_get_61 = _jspx_th_xlate_get_61.doStartTag();
    if (_jspx_th_xlate_get_61.doEndTag() ==
javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
      return true;
    _jspx_tagPool_xlate_get_key.reuse(_jspx_th_xlate_get_61);
    return false;
  }

Thanks for any insights you can provide.

Daniel Rabe
Eloquent, Inc.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message