struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Graham" <>
Subject Re: html:rewrite possible bug
Date Tue, 06 May 2003 17:25:13 GMT
Interesting, thanks for the info.  I found this previous bug:

The problem is that html:rewrite used outside of scripts should replace & 
with it's entity code and inside scripts in html documents it shouldn't.

What if we changed it to only use the entity code if the Struts tags are in 
XHTML mode?


>From: Tim Shadel <>
>Reply-To: "Struts Developers List" <>
>Subject: Re: html:rewrite possible bug
>Date: Tue, 06 May 2003 09:51:54 -0600
>Well, here's what the Mozilla people said:
>------- Additional Comments From  2003-05-05 16:59 
>If the page is served as text/html, so we treat is as HTML (see 
> for a good summary of the reasons). In 
>HTML, scripts are PCDATA and so &amp; is _NOT_ converted to '&' in script 
>data.  Attributes are CDATA, so &amp; is converted to '&'.
>Now in XHTML (served as XML), scripts are CDATA, so the conversion should 
>happen -- one of the areas where XHTML is incompatible with HTML.  Since 
>you're citing the XHTML compatibility guidelines, I assume you read 
> -- the example script in this bug MUST be 
>external for an XHTML document containing it to be labeled as text/html, 
>due to the above incompatibility.
>My test.jsp is returning as text/html.  It seems like the &amp; is valid 
>for an attribute (e.g. <a href="">), but not necessarily vaild inside 
><script></script> tags.  Since this is where <html:rewrite> is useful
>the taglib docs for it), it appears that this duplicity is needed to 
>support JavaScript URLs.
>It also appears that if we used XHTML, we should use a separate file for 
><script> tags; especially if they contain the '&' symbol.
>I'm not an HTML/XML/XHTML spec guru, so I'd love to hear your responses, 
>and you're welcome to battle it out with the Mozilla people on the bug 
>listed above.
>In the meantime, pages still break when Struts is used for encoding URLs in 
>JavaScript.  That requires users of Struts to basically recreate the 
>functionality of the tag in scriptlet code -- bypassing the whole point of 
>the tag.
>If both the Struts crew and the Mozilla crew hold their ground, it's the 
>Struts users that suffer.  Hopefully this issue can be resolved, and the 
>right party will make the change.
>Nathan Bubna wrote:
>>Tim said:
>>>>Both tags use RequestUtils.computeURL() to generate the url.
>>> >That method encodes ampersands if it is not a redirect.  This is
>>> >correct behavior.
>>> >
>>> >David
>>>I dunno.
>>Nathan Bubna
>To unsubscribe, e-mail:
>For additional commands, e-mail:

Add photos to your messages with MSN 8. Get 2 months FREE*.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message