tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pierre Delisle <pierre.deli...@sun.com>
Subject Re: More on JSP in XML format
Date Mon, 04 Dec 2000 18:50:24 GMT


Anne and Bill Moore wrote:
> ...
> I have now found a bug with scriplets.
> The <  character in a scriptlet are being parsed as if it were markup
> rather than being treated as Java syntax less than symbol.
> 
> For example the scriptlet
> 
> <%
>         for(int i=0; i<6; i++)
>            out.println(i);
> %>
> 
> works as expected in standard format jsp.
> 
> The xml format scriplet shown below produces an exception
> org.apache.jasper.compiler.ParseException The content beginning "<6" is
> not legal markup
> 
> <jsp:scriptlet>
> 
>         for(int i=0; i<6; i++)
>            out.println(i);
> 
> </jsp:scriptlet>

As "Bap" replied, you must make sure you "escape" content that can be
interpreted by XML. Remember, this is an XML document that is being
submitted to an XML parser.

By doing this:

<jsp:scriptlet>
<![CDATA[
    for(int i=0; i<6; i++)
        out.println(i);
]]> 
</jsp:scriptlet>

It should work fine.

> When you asked me to report bugs I was not sure if you mneant for me to
> enter them to bugrat - I created Bug Report #511 with synopsis
> "Error in parsing scriptlet when jsp is in xml format " to describe this
> problem.

Yes, bugrat is the preferred way to submit bug reports. If just submitted
to the mailing list, they unfortunately run the chance to fall through the 
cracks. 

    -- Pierre

Mime
View raw message