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 10683] New: - some problems with JSP documents in xml syntax
Date Thu, 11 Jul 2002 12:50:18 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=10683>.
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=10683

some problems with JSP documents in xml syntax 

           Summary: some problems with JSP documents in xml syntax
           Product: Tomcat 4
           Version: Unknown
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Jasper 2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: wtff@freenet.de


Usually I use normal jsp syntax but I now tried out the xml compliant syntax 
form and found three peculiarities. My estimation is that these are due to bugs 
within jasper but since I am not an expert on the xml-like jsp form, I'm 
insecure. Well, I would like to post a little example that depicts the three 
things that might be bugs. Within this example I also explain each bug and give 
reference to the paragraphs within the JSP 1.2 specification if I can.

The three issues I have are:
a) treatment of xml comments
b) treatment of mixed element content when taglib elements are involved
c) attribute expression evaluation 

I am pretty sure that b) is a bug. a) is a low prio thing and c) is a blocker 
for me.

But see the following example for details.
(If you also want to run it, you will need to have the EL-based JSTL core 
taglib installed.)

<jsp:root 
xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jstl/core" >
<html>
<body>
  <ul>
    <li>
      Request time attribute expressions don't seem to work 
      in jsp documents, or maybe I'm doing sth. wrong. 
      According to the JSP spec. paragraph 5.3.11, the quoting 
      convention used in jsp documents is as follows:
      <a href="%= response.encodeURL('thispage.jsp') %">
        However, the expression inside the href attribute
        is not being evaluated.
      </a>
      <br />
    </li>
    <li>
      If an xml element contains mixed content, e.g. plain text 
      and other xml elements, then the resulting output is not 
      correct in every case. If plain text is directly preceding 
      a taglib element, then the taglib output is written to the 
      jsp-outputstream prior to the plain text.
      For example, note that the following JSTL tag should deliver 
      its output behind this text here, but within the webpage the 
      taglib output will appear first.
      <c:out value="THIS TEXT SHOULD NOT APPEAR FIRST." /> 
      <br />
      If however the plain text preceding a taglib element is 
      interleaved with other xml elements, as it is done here, then 
      everything works fine again.
      <br />
      <c:out value="TAGLIB TEXT" />
      See ? (And plain text behind a taglib element is also save.)
      <br />
    </li>
    <li>
      In the resulting page, the javascript at the end of this page
      is missing. The comment around the javascript part is needed 
      by some browsers. I could place the body of the 
      script element into a CDATA section but I believe 
      that it is a bug to erase xml comments from the 
      source page. Also, if I would just place a jsp:text 
      element arount the javascript, this would also 
      erase the xml comment. Unfortunately the JSP spec 
      doesn't explicitly mention the treatment of xml comments 
      and whether they should be erased or not.
      In addition to that it is a pity that the SAX API's 
      don't really report the occurence of xml comments. 
      Only the org.xml.sax.ext.LexicalHelper does, but it 
      is an optional extension to SAX2 and can only be plugged 
      in as an attribute to the parser. ;(
    </li>
  </ul>
</body>
<script language="javascript">
<!--

function veryImportantFunction()
{
alert("An xml-comment is an xml-comment and may not be skipped.");
}

//-->
</script>
</html>
</jsp:root>

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


Mime
View raw message