部署项目时,报了这样的异常:
HTTP Status 500 - Unable to convert string “${item.createtime}” to class “java.util.Date” for attribute “value”: Property Editor not registered with the PropertyEditorManager
主要原因是EL表达式无法被解析到.
其实从后台取值并传值到前台来根本就没有错,而前台JSP页面EL表达式无效,解析不到EL表达式,引起的原因是web.xml中:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
注意里面的web-app_3_0.xsd,就是这个引起的,在web-app_2_4.xsd中就不会出现这种问题(这个版本的isELIgnored默认设置为false)。
在不改变web.xml3.0版本的情况下解决办法是:在jsp页面头加:<%@page isELIgnored="false"%>
问题得以解决。
或加在:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" isELIgnored="false" %>