jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Brennan.O'S...@alltel.com>
Subject JSTL - question about formatDateSupport and BodyContent
Date Tue, 02 Apr 2002 22:31:18 GMT
In using the JSTL example formatDateTime.jsp, I don't get any dates
displayed.  In the examples, the current date is supposed to be
displayed since "value" is not specified and the <fmt:formatDate/> tags
don't have a body.

The problem is that getBodyContent() returns an empty string for the
tags in the example JSP.  Since the code from FormatDateSupport below
only uses the current date when the value attribute is not specified AND
getBodyContent() is null, no dates show up in the browser.

if (!valueSpecified && (getBodyContent() == null)) {
    // 'value' missing, use current date
    value = new Date();
} 

I discovered that when I close the tag without using the shorthand
notation:

   <fmt:formatDate type="both" dateStyle="full"
timeStyle="full"></fmt:formatDate>

instead of:

   <fmt:formatDate type="both" dateStyle="full" timeStyle="full"/>

It works -- I get the current date.  getBodyContent does NOT return null
when using the shorthand notation, but returns an empty String instead.


I'm using the standard beta 1 version of JSTL on Tomcat 4.0.1.  Is this
a bug in the tag?  Should the code above check for an empty string as
well as null when determining whether to use the current date?  It seems
to me that getBodyContent() should have the same behavior regardless of
shorthand (/>) or normal empty tag notation -- however I could not find
a definition of what constitutes an empty tag in the JSP 1.2 spec.

What gives?

Thanks.
Brennan

--
To unsubscribe, e-mail:   <mailto:taglibs-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-dev-help@jakarta.apache.org>


Mime
View raw message