Reputation: 920
Below is my codes, everything works fine but the fmt not.
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
tags directory
\projectName\web\WEB-INF\tags
Result
Hello // from core
???message.username??? //the fmt:message.username not working
Could anyone help me out, why fmt didn't works ? I have tried creating 3 or more projects with using jstl. All the jstl is working but only the fmt not.
Upvotes: 2
Views: 5207
Reputation: 920
Finally I solved it. Following codes have to be inserted in web.xml
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>com.projectName.resources.ApplicationResource</param-value>
</context-param>
Upvotes: 5