dev@javaserverfaces.java.net

Re: Problems with & handling between RI and Facelets

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 28 Jul 2006 10:43:11 -0700

Michael Youngstrom wrote:
> 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?

For the HTML case, it's pretty clear, we need to render '&'. However,
I think if the content-type is determined to be xhtml, I don't see why we
couldn't render '&amp;' instead.


>
> 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
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_javaserverfaces.dev.java.net
> For additional commands, e-mail: dev-help_at_javaserverfaces.dev.java.net
>