dev@javaserverfaces.java.net

Problems with & handling between RI and Facelets

From: Michael Youngstrom <youngm_at_gmail.com>
Date: Fri, 28 Jul 2006 11:23:13 -0600

I'm sending this to both the RI and facelets list because I'm not sure
who's problem it is. The following code does not work when using
JSF-RI 1.2 and Facelets.

<h:outputLink value="http://www.google.com">
     <f:param name="param1" value="20"/>
     <f:param name="param2" value="30"/>
     Some Link
</h:outputLink>

When that code is placed in Facelets I get an XML Parsing Error. The
Facelets xml parser is not handling the & that is written from the
h:outputLink. If I hardcode the anchor into my page like this:

<a href="http://www.google.com?param1=20&param2=30">

I get the same error. If I change the & to an entity reference &amp;
then everything works fine. If I create a plain .html page with a
link using the entity reference &amp; then the link appears to work
fine. So I figured that perhaps the RI should be writing an &amp;
when rendering the outputLink instead of an &. However, doing a
search on the RI list found this bug
https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=173 which
is addressing the same issue but for a graphicImage and directs the
graphicImage to output an & instead of an &amp;. So the question is
should the RI be outputing &amp; or &. Or should facelets be
processing the JSF generated xhtml differently?

Incidentally the xml spec says that the & in an attribute should be
escaped as an entity reference:

http://www.w3.org/TR/REC-xml/#dt-chardata

So how do we fix this?

Mike