JSTL fmt标签在IE中不起作用? [英] JSTL fmt tag does not work in IE?
问题描述
IE似乎忽略了JSTL中的fmt标记。我尝试过fmt:formatNumber和fmt:formatDate,既不能在IE中工作,但它们可以在所有其他浏览器中使用。 (我正在使用IE8和JSTL 1.1)
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)
这是一个已知问题吗?
这是一个例子代码不起作用:
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" />
推荐答案
JSP / JSTL在服务器端执行,它有与您正在使用的浏览器无关。
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?
编辑: fmt
标记受执行线程的当前Locale的影响,Spring从http请求中获取该Locale。如果IE传递的语言环境指示与其他浏览器不同(由于某种原因,我不知道为什么),那么 fmt
标签可能会改变其输出。
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.
您需要确保所有浏览器都传递相同的区域设置,或者您可以在JSP中覆盖它以强制它对每个人都相同:
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>
- 设置指定范围的默认
区域设置。这个
将覆盖基于浏览器的语言环境。
<fmt:setLocale>
- Sets the default locale for the specified scope. This will override the browserbased locale.
这篇关于JSTL fmt标签在IE中不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!