jsp 不解析pre,JSP错误:包含无效的表达式。解析表达式失败

I am trying to debug an old jsp site and so I installed tomcat 7 and Netbeans IDE 7.2.1 on my local machine running windows 7 and got everything setup. But when I run it, I am getting an error:

SEVERE: Servlet.service() for servlet jsp threw exception

org.apache.jasper.JasperException: /pages/caselisting.jsp (line: 133, column: 35) "${case.patientmaxdate}" contains invalid expression(s): javax.el.ELException: Failed to parse the expression [${case.patientmaxdate}]

The code at that line is:

I am very new to jsp and am trying to make some changes to this old site. I did some research and read that Tomcat 7 made some changes for this error. I would appreciate if somebody can guide me in the right direction.

Thanks.

The complete stack trace:

SEVERE: Servlet.service() for servlet jsp threw exception

org.apache.jasper.JasperException: /pages/caselisting.jsp (line: 133,

column: 35) "${case.patientmaxdate}" contains invalid expression(s):

javax.el.ELException: Failed to parse the expression

[${case.patientmaxdate}] at

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)

at

org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)

at

org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:199)

at

org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1223)

at

org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:875)

at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)

at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) at

org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428) at

org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:894)

at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1539)

at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) at

org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2428) at

org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2434) at

org.apache.jasper.compiler.Node$Root.accept(Node.java:475) at

org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2376) at

org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1795)

at

org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:217)

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:373) at

org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) at

org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) at

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)

at

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)

at

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at

org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)

at

org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)

at

org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)

at

org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)

at

org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1056)

at

org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcessor.java:261)

at

org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:388)

at

org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequestProcessor.java:316)

at

org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:231)

at

org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)

at

org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at

javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)

at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at filter.SecureFilter.doFilter(SecureFilter.java:38) at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)

at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)

at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)

at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)

at

org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)

at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)

at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)

at

org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)

at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)

at

org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)

at

org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)

at

org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)

at

org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)

at

java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

at

java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

at java.lang.Thread.run(Thread.java:722)

The complete code surrounding the error line is:

Here caselist is an array list.

解决方案

Not sure whether you ended up solving this one, but having just had a similar problem and solving it, I thought I'd chip in.

The expression parser in Tomcat 7 is apparently less permissive than it was in previous versions. It doesn't like attribute names in EL expressions that clash with reserved keywords in Java.

In your example, the parser might be complaining that you are using the variable name 'case' in your forEach loop. The name 'case' is obviously a reserved Java keyword.

You should change the variable name to something that isn't reserved (perhaps 'aCase'):

Alternatively, there is a system property that you can set that will make Tomcat 7 more permissive:

-Dorg.apache.el.parser.SKIP_IDENTIFIER_CHECK=true

You'll need to add that to the end of the list of properties in the Java Options box in the Tomcat 7 properties window (run Tomcat7w.exe).

419a3f3010f9c87287b3e869d3f9f631.png

That will then apply to all pages in all apps you have running in Tomcat 7.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值