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:
<td><c:out default=" " escapeXml="false" value="${case.patientmaxdate}"/></td>
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:
<c:forEach items="${caselist}" var="case">
<tr onMouseOver="this.bgColor='#EEEEEE';" onMouseOut="this.bgColor='';">
<td><c:out default=" " escapeXml="false" value="${case.patientmaxdate}"/></td>
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'):
<c:forEach items="${caselist}" var="aCase">
<tr onMouseOver="this.bgColor='#EEEEEE';" onMouseOut="this.bgColor='';">
<td><c:out default=" " escapeXml="false" value="${aCase.patientmaxdate}"/>
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).
That will then apply to all pages in all apps you have running in Tomcat 7.
The Java keywords (like case
, instanceof
, if
, while
, class
, return
, static
, etc.) cannot be used as variable/function names in EL. Prefer using different names, for example:
<c:forEach items="${caselist}" var="cs">
<tr onMouseOver="this.bgColor='#EEEEEE';" onMouseOut="this.bgColor='';">
<td><c:out default=" " escapeXml="false" value="${cs.patientmaxdate}"/></td>
</c:forEach>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With