tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 24779] New: - Jasper fails to parse correct XML syntax JSP page with certain EL expressions.
Date Tue, 18 Nov 2003 12:09:08 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24779>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=24779

Jasper fails to parse correct XML syntax JSP page with certain EL expressions.

           Summary: Jasper fails to parse correct XML syntax JSP page with
                    certain EL expressions.
           Product: Tomcat 5
           Version: 5.0.14
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: growler@tula.net


It appears that certain JSP 2.0 EL expressions may or may not work
depending on choosen JSP syntax. E.g., jsp page in standard syntax

<html>
  <head>
  </head>
  <body>
    ${header["user-agent"]}<br/>
    \${header["user-agent"]}<br/>  
  </body>
</html>

is ok, but jsp page in xml syntax 

<?xml version="1.0" encoding="iso-8859-1"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0">
<jsp:directive.page contentType="text/html"/>
<html>
  <head>
  </head>
  <body>
    ${header["user-agent"]}<br/>
    \${header["user-agent"]}<br/>  
  </body>
</html>
</jsp:root>

will result into "org.apache.jasper.JasperException: /test.jsp() Unterminated ${
tag" exception.

I believe the problem is withing JspDocumentParser.java code. The
characters() function assumes that the parser always passes the content
of a text node with a single call which is not always the case.
Actually, org.xml.sax.ContentHandler API specifies that "SAX parsers may
return all contiguous character data in a single chunk, or they may
split it into several chunks". Moreover, it splits text nodes content
into several chunks whenever it meets '[' or ']' within the node, so the
code fails to parse any correct EL expression using array access syntax.

Also please note that escaping EL expression with '\' character also doesn't
work with XML syntax.

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message