DO NOT REPLY [Bug 45620] New: formatDate fails when local is missing

[email protected]
Newsgroups gmane.comp.jakarta.taglibs.devel
Message-ID <[email protected]/bugzilla/>
https://issues.apache.org/bugzilla/show_bug.cgi?id=45620

           Summary: formatDate fails when local is missing
           Product: Taglibs
           Version: unspecified
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Keywords: NeedsReleaseNote
          Severity: normal
          Priority: P2
         Component: I18N Taglib
        AssignedTo: [email protected]
        ReportedBy: [email protected]


Some browsers (IE from GoogleEarth) do not pass local information in the HTTP
header for the request, therefore request.getLocale() returns null.  When this
happens the following tag fails even though a pattern and timezone are
specified:

<fmt:formatDate value="${d}" pattern="yyyy-MM-dd HH:mm z" timeZone="GMT"/>
The above just prints out d.toString()

SimpleDateFormat has all the elements it needs for a successful format, it
should format the date as expected instead of using d.toString()


Workaround:
You can add the following to your JSP and it will work.
<c:choose>
    <c:when test="${request.locale == null}">
        <fmt:setLocale value="en_US" />
    </c:when>
</c:choose>


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.