You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Rich Unger <Ri...@netbeans.org> on 2003/09/11 02:29:02 UTC

jsp 1.2 and escaping quote marks

<?xml version="1.0" encoding="utf-8"?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
   <html>
      <img src="foo.jpg" alt='My "quoted" text.'/>
      <img src="foo.jpg" alt="My &quot;quoted&quot; text."/>
      <img src="foo.jpg" alt="My &#34;quoted&#34; text."/>
   </html>
</jsp:root>

All 3 of these lines cause compile errors.  I'm using XSLT to generate
files which _may_ be JSP files (they may be static files, it's determined
when the xslt runs).  Because of this, I'm not particularly enthused about
manually sticking backslashes in front of my quote characters.

What I want to know is, how does tomcat 4 know to escape the quote marks
around foo.jpg, as in:

      out.write("<img src=\"foo.jpg\" alt='My "quoted" text.'/>");

...but not around "quoted"?  Is it a bug, or is this an expected compile
error in my jsp?

Thanks,
Rich


Re: jsp 1.2 and escaping quote marks

Posted by Rich Unger <Ri...@netbeans.org>.
Umm... That's the second example in my original post.

On Wed, 10 Sep 2003 22:52:38 -0700, Bill Barker wrote:

> Does this work:
>   <img src="foo.jpg" alt="My &quot;quoted&quot; text." />
> 
> "Rich Unger" <Ri...@netbeans.org> wrote in message
> news:pan.2003.09.11.00.29.00.609000@netbeans.org...
>> <?xml version="1.0" encoding="utf-8"?>
>> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
>>    <html>
>>       <img src="foo.jpg" alt='My "quoted" text.'/>
>>       <img src="foo.jpg" alt="My &quot;quoted&quot; text."/>
>>       <img src="foo.jpg" alt="My &#34;quoted&#34; text."/>
>>    </html>
>> </jsp:root>
>>
>> All 3 of these lines cause compile errors.  I'm using XSLT to generate
>> files which _may_ be JSP files (they may be static files, it's determined
>> when the xslt runs).  Because of this, I'm not particularly enthused about
>> manually sticking backslashes in front of my quote characters.
>>
>> What I want to know is, how does tomcat 4 know to escape the quote marks
>> around foo.jpg, as in:
>>
>>       out.write("<img src=\"foo.jpg\" alt='My "quoted" text.'/>");
>>
>> ...but not around "quoted"?  Is it a bug, or is this an expected compile
>> error in my jsp?
>>
>> Thanks,
>> Rich



Re: jsp 1.2 and escaping quote marks

Posted by Bill Barker <wb...@wilshire.com>.
Does this work:
  <img src="foo.jpg" alt="My &quot;quoted&quot; text." />

"Rich Unger" <Ri...@netbeans.org> wrote in message
news:pan.2003.09.11.00.29.00.609000@netbeans.org...
> <?xml version="1.0" encoding="utf-8"?>
> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2">
>    <html>
>       <img src="foo.jpg" alt='My "quoted" text.'/>
>       <img src="foo.jpg" alt="My &quot;quoted&quot; text."/>
>       <img src="foo.jpg" alt="My &#34;quoted&#34; text."/>
>    </html>
> </jsp:root>
>
> All 3 of these lines cause compile errors.  I'm using XSLT to generate
> files which _may_ be JSP files (they may be static files, it's determined
> when the xslt runs).  Because of this, I'm not particularly enthused about
> manually sticking backslashes in front of my quote characters.
>
> What I want to know is, how does tomcat 4 know to escape the quote marks
> around foo.jpg, as in:
>
>       out.write("<img src=\"foo.jpg\" alt='My "quoted" text.'/>");
>
> ...but not around "quoted"?  Is it a bug, or is this an expected compile
> error in my jsp?
>
> Thanks,
> Rich