今天在部署一个项目时,报了这样的异常: java
org.apache.jasper.JasperException: Unable to convert string "${topic.postTime}" to class "java.util.Date" for attribute "value": Property Editor not registered with the PropertyEditorManager
起初着实不知道是哪里的错.通过几个小时的扎腾才有点端倪.
主要缘由是EL表达式没法被解析到.
其实从后台取值并传值到前台来根本就没有错,而前台JSP页面EL表达式无效,解析不到EL表达式,引发的缘由是web.xml中: web
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
maven默认生成的web.xml版本是2.3的,因此有些配置节点idea会识别不出来,所以咱们从新添加一个3.1的。apache
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
还有就是:<%@page isELIgnored="false"%>的优先级要高于web.xml中的设置,因此在JSP中的设置会盖掉web.xml中的设置.app