下面是我的代码,一切正常,但fmt没有。
web.xml
<jsp-config>
<taglib>
<taglib-uri>/WEB-INF/tags/jstl-fmt.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/fmt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tags/jstl-fmt-1_0.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/fmt-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tags/jstl-fmt-1_0-rt.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/fmt-1_0-rt.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tags/jstl-c.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/c.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tags/jstl-c-1_0.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/c-1_0.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/WEB-INF/tags/jstl-c-1_0-rt.tld</taglib-uri>
<taglib-location>/WEB-INF/tags/c-1_0-rt.tld</taglib-location>
</taglib>
</jsp-config>Sample.jsp
<%@ taglib uri="/WEB-INF/tags/jstl-fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tags/jstl-c.tld" prefix="c" %>
<html:form action="/UserAction.do">
<fmt:message key="message.username"/>
<c:out value="Hello" />
</html:form>ApplicationResource.properties
message.username=Username标签目录
\projectName\web\WEB-INF\tags

结果
Hello // from core
???message.username??? //the fmt:message.username not working有人能帮我吗,为什么fmt不起作用?我尝试过使用jstl创建3个或更多项目。所有的jstl都在工作,但只有fmt没有工作。
发布于 2013-10-12 01:47:38
我终于解决了。必须在web.xml中插入以下代码
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>com.projectName.resources.ApplicationResource</param-value>
</context-param> https://stackoverflow.com/questions/19321837
复制相似问题