hi Kris, thank you for your answer! I'm sorry I didn't find that statement before posting. Ok, it's 100% spec compliant... let's hope the spec will be changed in the future. It would also be backwards-compatible since noone relies on the *absence* of a HTTP request header to determine the date format anyway.
IMHO the problem is someone (like me :) could write: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <jsp:useBean id="now" class="java.util.Date" /> <fmt:formatDate var="currentYear" value="${now}" pattern="yyyy"/> <c:forEach begin="1976" end="${currentYear}" varStatus="status"> ${status.index} </c:forEach> and see this: javax.servlet.jsp.el.ELException: An exception occured trying to convert String "Thu Oct 14 14:59:29 CEST 2004" to type "java.lang.Integer" flavio On Thursday 14 October 2004 13:33, Kris Schneider wrote: > I'm not arguing whether or not it's the *best* thing to do, but the JSTL > 1.1 Spec. includes: > > 9.9 <fmt:formatDate> > .. > Null & Error Handling > - If value is null or empty, nothing is written to the current JspWriter > object and the scoped variable is removed if it is specified (see > attributes var and scope). > - If timeZone is null or empty, it is handled as if it was missing. > - If this action fails to determine a formatting locale, it uses > java.util.Date.toString() as the output format. > > So, it looks like it's at least behaving according to the spec... > > Quoting Flavio Tordini <[EMAIL PROTECTED]>: > > Hi all, > > I'm using the fmt:formatDate tag and I discovered a strange behaviour: > > > > When a JSP is requested without specifying the "Accept-Language" HTTP > > header > > > > and no locale has been explicitly set in the JSP, the date is not > > formatted and the result of Date.toString() is returned instead. > > > > I checked the JSTL spec, this is what it says to do when the algorithm > > cannot > > > > find a Locale: > > "If no match is found after the above two steps, it is up to the > > formatting action to take a corrective action." > > I don't know what "corrective action" means in this context, but I think > > that > > > > using the default JVM locale would be much better than toString(). > > > > here's a sample JSP, you can test it with curl or wget: > > > > <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> > > <jsp:useBean id="now" class="java.util.Date" /> > > <fmt:formatDate value="${now}" pattern="yyyy"/> > > > > regards, > > flavio tordini --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]