2

I'm using struts2 in my application and I get the following error when I run my app in Tomcat org.apache.jasper.JasperException: /myapp/testReview.jsp (line: 29, column: 45) quote symbol expected

line29: <s:iterator value="testSummaryList" status=stat> <s:iterator> <tr> <td><s:property value="value" /></td> <td><s:property value="key" /></td> </tr> </s:iterator> </s:iterator> Same code works fine when I deploy my app in WebSphere. This fixes the error in Tomcat status="stat"

Is this something to do with the Tomcat JSP compiler?

Srini
  • 25
  • 5

1 Answers1

1

No, it's to do with the way the JSTL (XML) is parsed:

http://www.herongyang.com/JSP/JSTL-Overview-General-Syntax-of-JSTL-Tags.html

Having the value of the status attribute without quotes renders it invalid, hence the JasperException when the file is parsed.

The rest of your stack trace will probably look like this:

org.apache.jasper.JasperException: /myapp/testReview.jsp (line: 29, column: 45) quote symbol expected
org.apache.jasper.compiler.DefaultErrorHandler.jsp Error(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:198)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:148)
org.apache.jasper.compiler.Parser.parseUseBean(Parser.java:929)
org.apache.jasper.compiler.Parser.parseStandardAction(Parser.java:1112)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1421)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)

So you should see that the Parser class threw the exception (although this is part of the JSP compilation process).

Michael
  • 7,348
  • 10
  • 49
  • 86
  • Are you saying that the file is parsed differently in Tomcat and WebSphere? – Srini Aug 19 '15 at 15:23
  • Yes, different containers, versions and builds will all have nuanced differences. I'd imagine that Tomcat parses the XML in a "strict" way, whereas WebSphere is more tolerant (there is probably a setting available to change that behaviour). – Michael Aug 19 '15 at 15:29