Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Jstl <fmt:formatDate> problem

843840Nov 26 2008 — edited Feb 5 2009
Hi everyone,

I have been spending a lot of time on this "simple" issue and i hope someone is able to help. All i want to do is simple format a date and display it correctly.

This is jsp page:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html>
<body>
	<jsp:useBean id="now" class="java.util.Date" />
	
	<fmt:formatDate pattern="yyyy-MM-dd" value="${now}" />


</body>
</html>
This is the error i get when running this in the newest tomcat:
org.apache.jasper.JasperException: Unable to convert string "${now}" to class "java.util.Date" for attribute "value": Property Editor not registered with the PropertyEditorManager
	org.apache.jasper.runtime.JspRuntimeLibrary.getValueFromPropertyEditorManager(JspRuntimeLibrary.java:887)
	org.apache.jsp.index_jsp._jspx_meth_fmt_005fformatDate_005f0(index_jsp.java:135)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:86)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
I lib folder (version 1.1.2):
- jstl.jar
- standard.jar

In WEB-INF/tld folder:

- fmt.tld
- c.tld

Web.xml looks like this:
<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  
   <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
    		    
  </taglib>
  <taglib>
    <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
    <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
  </taglib>

</web-app>
I really hope someone is able to help - let me know if you need more information!

Thanks!

/Kasper
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 5 2009
Added on Nov 26 2008
8 comments
3,682 views