Bug 52361 - JasperException at JSP compilation
Summary: JasperException at JSP compilation
Status: CLOSED INVALID
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 6.0.35
Hardware: PC Windows XP
: P2 regression (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-19 13:28 UTC by lvw
Modified: 2011-12-20 09:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description lvw 2011-12-19 13:28:28 UTC
When a tag attribute contains a JSP scriplet, an compilation exception is thrown if there is a double quote inside the scriplet.
Example:
<select:myControl name="blabla" lng="<%=bNorth?"nl":"fr"%>" />

There were no problems with such instructions in the previous tomcat versions (<=6.0.28).

stack trace:
org.apache.jasper.JasperException: /test.jsp(258,104) Attribute value bEn?"en":"fr" is quoted with " which must be escaped when used within the value
        at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
        at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
        at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
        at org.apache.jasper.compiler.Parser.parseAttributeValue(Parser.java:256)
        at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:205)
        at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:148)
        at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1208)
        at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1422)
        at org.apache.jasper.compiler.Parser.parse(Parser.java:130)
        at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
        at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
        at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
...
Comment 1 Mark Thomas 2011-12-19 16:13:39 UTC
That JSP extract is invalid as per the JSP specification.

This has been discussed multiple times in the archives.

If you can't find the solution in the archives, please use the Tomcat users mailing list to get further support.
Comment 2 lvw 2011-12-20 08:53:39 UTC
You are right, this syntax is not correct. This code is not recent and It was successfully compiled with previous tomcat versions so I conclude to quickly it was a bug.
Thank you.