---
title: "EL表达式在tomcat7.0下的new关键字不能使用"
author: "cn-done"
date: "2012-08-24T17:25:15Z"
tags: []
categories: ["编程语言"]
slug: "el-tomcat7-0-new"
draft: false
lastmod: "2012-08-24T17:25:15Z"
id: 1662064
url: "https://cn-done.iteye.com/blog/1662064"
---

最近生产系统部署个小应用，服务器选型tomcat7.0，一直运行得好好的，最近看日志发现消息发布功能报白页。贴日志：

```
org.apache.jasper.JasperException: /news/listNews.jsp (line: 32, column: 70) "${new.title}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${new.title}]
```

 本地环境tomcat6.0跑起来好好的。

 

参考文档：http://stackoverflow.com/questions/3879794/spring-3-petclinic-owner-new-invalid-expression-in-tomcat-7

 

T7.0里面："new" is a Java **keyword** and hence ${owner.new} is not legal EL。Tomcat 7 enforces this rule by default (Tomcat 6 doesn't for backwards compatibility). The bug is in the Spring sample app.

 

PS：升级tomcat到7.0所有的EL表达式中的new属性都得替换，问题解决。