Hi Eric:
> Ok, I now reinstalled Tomcat (4.0.3, full version) and the nightly JSTL
> build (everything as binaries). Now it works, but not everything...
>
> - For I18N, the "Parametric Replacement" and "Date" example gives me
> javax.servlet.ServletException: Unparseable date: ""
I managed to reproduce your problem with Tomcat 4.0.3, but not with
Tomcat 4.1 nightly build.
The behaviour of <fmt:formatDate>, which causes the problem in the
examples you mentioned, is as follows: If the 'value'
attribute is missing and the action does not have any body, the current
date is formatted. This is implemented in the doEndTag() method of
<fmt:formatDate>'s tag handler, as follows:
if (!valueSpecified && (getBodyContent() == null)) {
// 'value' missing, use current date
value = new Date();
}
(If the 'value' attribute is present, "valueSpecified" will have been
set to TRUE in the corresponding attribute setter method.)
I set a breakpoint at the above condition and printed the values of
"valueSpecified" and getBodyContent().
In the examples where you saw the error, <fmt:formatDate> neither
has a 'value' attribute nor a body. As expected, "valueSpecified" is
FALSE with both Tomcat 4.0.3 and 4.1. However, getBodyContent()
returns an empty string on Tomcat 4.0.3, which I think is a bug
(it is supposed to return null for an empty body). Therefore,
<fmt:formatDate> assumes that it is supposed to format the
empty string as a date. As with any string, it first attempts to
parse the string as a date, which of course fails if the string is
empty and produces the exception you saw.
On Tomcat 4.1, getBodyContent() does return null, and therefore the
above condition evaluates to TRUE, causing the current date to be stored
in "value" and formatted.
Hope this helps.
Jan
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>