Bug 4181 - doAfterBody() function does not adhere to the JSP 1.2 specification
Summary: doAfterBody() function does not adhere to the JSP 1.2 specification
Alias: None
Product: Taglibs
Classification: Unclassified
Component: DateTime Taglib (show other bugs)
Version: 1.0
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2001-10-15 14:03 UTC by Dennis Munsie
Modified: 2004-11-16 19:05 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Munsie 2001-10-15 14:03:17 UTC
The datetime tag library that is depending on a broken feature in Tomcat and 
other servers (WLS 5.1, for example).  With servers that properlly implement 
the JSP 1.2 specification, this library will not work.

The following JSP code will not work:

<date:format pattern="MM/dd/yyyy" date="<%=new Date()%>"/>

The output is:

The format tag is using the doAfterBody() call to place it's output into the 
JSP.  But, since there is no body in the tag, the doAfterBody() function is not 

From looking at the code, the fix would be to have the code that is in the 
doAfterBody() function be done in the doEnd() function instead (minus the code 
that actually processes the body).

The problem is occuring because the tag library is doing all of the date 
formating within the doAfterBody() function, and the specification says 
that "The method (doAfterBody()) is not invoked if there is no body evaluation" 
(section of the JSP specifcation).  Since the function is not called, 
the variable date_formatted in the tag library is never set, causing the null 
that is being returned.
Comment 1 Glenn Nielsen 2002-04-04 18:03:01 UTC
Thanks for reporting this. The output for the format tag is now done in the
doEnd() instead of doAfterBody(). This change was made 2/23/2002.