Mantis - Resin
Viewing Issue Advanced Details
2042 minor always 10-04-07 09:49 10-31-07 09:18
ferg  
ferg  
normal  
closed 3.1.3  
no change required  
none    
none  
0002042: JSTL c:url with escaping
(rep by Matt White)


Please forgive me if this is a frequently asked question, I have only
recently re-subscribed this list and don't see this issue in the
documentation.

If I have a snippet of JSP code that looks like this:

<a href="<c:url value="someFile.jsp"><c:param name="w"
value="1"/><c:param name="h" value="2"/></c:url>">Click Me!</a>

Resin's JSTL will produce a URL that looks like this:

someFile.jsp?w=1&h=2

...which, if you ask me, is a perfectly valid URL and is the response
I'd expect. The W3C disagrees.


According to the W3C's validator (and the HTML validator plugin for
FireFox I'm using), the URL should be written like this:

someFile.jsp?w=1&amp;h=2

Notice how the & has been escaped into &amp;... one could argue that
this is a silly change as "&amp;" contains "&", but that just the way
these things work... *grumble*


Is there a way to make Resin's JSTL implementation spit out &amp;
instead of & on URLs?

Notes
(0002418)
ferg   
10-31-07 09:18   
Resin's c:url is correct. c:url does not XML-escape '&'. You'll need to use c:url with a var parameter and pass the result to c:out and escapeXml='true' to get the XML escaping.