tags:

views:

301

answers:

2

IE seems to ignore the fmt tag in JSTL. I've tried with fmt:formatNumber and fmt:formatDate, and neither work in IE but they work in all other browsers. (I'm using IE8 and JSTL 1.1)

Is this a known problem?

Here's an example of code that doesn't work:

<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:formatNumber maxIntegerDigits="2">2003</fmt:formatNumber>
<fmt:formatNumber maxIntegerDigits="2" value="2003" />
+5  A: 

JSP/JSTL is executed server-side, it has nothing to do with what browser you're using.

Something is mis-configured on your server.

What do you mean by "doesn't work"? Does it throw an exception, does it give you a blank page, what?


edit: The fmt tag is influenced by the current Locale of the executing thread, which Spring takes from the http request. if IE is passing a different locale indication than the other browsers (for some reason, I don't know why), then the fmt tag could change its output.

Either you need to make sure all browsers are passing the same locale, or you can override it in the JSP to force it to be the same for everyone:

<fmt:setLocale> - Sets the default locale for the specified scope. This will override the browserbased locale.

skaffman
The code I posted (two variations of the same thing) should display "03", which it does if I open the page in FF, Opera, Chrome or Safari. If I open it in IE it displays "2003". So IE seems to ignore the fmt tag. Other JSTL tags like c: and sql: work fine in IE.
Carl-Erik
A: 

I found a solution! If I use the fmt:setLocale tag first, the other tags start working for some reason... Doesn't seem to matter what locale I set it to either.

Carl-Erik