Jstl <fmt:formatDate> problem

来源:互联网 发布:ubuntu系统运行py文件 编辑:程序博客网 时间:2024/06/06 01:24

错误提示:
Unable to convert string "${item.startTime}" to class "java.util.Date" for attribute "value":
Property Editor not registered with the PropertyEditorManager

<c:forEach var="item" items="${list}">    <tr>    <td><fmt:formatDate value='${item.startTime}' pattern="yyyy-MM-dd HH:mm:ss "></fmt:formatDate></td>    <td><fmt:formatDate value='${item.endTime}' pattern="yyyy-MM-dd HH:mm:ss "></fmt:formatDate></td>     </tr></c:forEach>

jsp页面写的是没问题的

web.xml 开头是这么写的:

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

这样写就出问题了,应该改为

<?xml version="1.0" encoding="UTF-8"?><web-app     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"    xmlns="http://java.sun.com/xml/ns/javaee"    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"    id="WebApp_ID"    version="2.5">    <!-- Configuration here. --></web-app>

因为Tomcat的支持web.xml 的Servlet是 2.5版本。

0 0