You are viewing a plain text version of this content. The canonical link for it is here.
Posted to watchdog-dev@jakarta.apache.org by "Davidson, Misha" <MD...@silverstream.com> on 2000/07/26 22:07:26 UTC

TagLib Info at runtime

Hi,

As you may have guessed from my previous e-mails, I have found an issue 
with the tests, and I was wondering if you could help me sort it out. The 
problem at hand has to do with availability of the TagLib classes 
initialized with the TLD information at runtime.

Specifically, doInitBody() method in the TestTag class makes an extensive 
use of the TagInfo, TagLibraryInfo and TagAttributeInfo classes. My 
understanding is that these classes are used at the time a JSP is compiled 
and are not required for running a page with custom tags in it. Section 6.2 
(describing the contents of javax.servlet.jsp.tagext package) says: 
“Classes whose name ends in Info are transformation-time classes. Instances 
[sic] are initialized from the TagLibraryDescriptor [sic] …” This is in 
contrast with the “runtime environment” classes defined in section 6.1.

It is rather unfortunate that the spec never defines what translation-time 
vs. request time really means.  However, one can take a reasonable 
assumption that the “translation-time” means JSP->Java->class compilation, 
while “request-time” means the behavior of the resulting class on the server.

In SilverStream, we make a strong distinction between the deployment 
(translation) and runtime (request-time) environments. In fact, compilation 
of JSPs in our system is done by a standalone client deployment tool, and 
only the resulting classes are uploaded to the server. This decoupling is 
consistent with the approach taken by other J2EE technologies (like EJB). 
Under this approach the TLD is read by the deployment tool, which uses the 
TLD to populate the TagLib Info classes, which in turn are used to verify 
the JSPs and generate the corresponding servlet classes. The TLD itself is 
never uploaded to the server, because as a “descriptive mechanism for 
providing information on a TagLibrary” (Section 5.3) it is not needed on 
the server once the JSP is compiled.

This is where we run into a problem with about half dozen tests that use 
TestTag. DoInitBody() method in this tag class tries to make use of the 
TagLib Info classes. However, since the TLD is not available at runtime the 
values in the Info classes are not initialized and the tests fail.

I assume that these tests work in Tomcat because the translation happens on 
the server and the TagLib Info classes initialized during compilation are 
still available at runtime. I think, however, that the availability of 
fully initialized TagLib Info classes at runtime is an artifact of how 
Tomcat works. It is NOT a generally required by the spec that TagLib Info 
classes be initialized from the TLD at runtime. Therefore, this bit of 
functionality should not be the part of the general-purpose watchdog tests. 
Would you agree with me on that? Or did I miss something in the spec?

Thanks you very much,
-Misha
misha@silverstream.com