Encoding Ampersands in Query String

Splash Forums PrettyFaces Users Encoding Ampersands in Query String

This topic contains 7 replies, has 3 voices, and was last updated by  Lincoln Baxter III 10 years, 8 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
  • #17920


    I’ve been using Pretty Faces for about a week and I have to say it really makes the JSF experience much much better – thank you.

    One issue that I’ve run into however is that rewritten URLs containing multiple query parameters write the literal ampersand character in the HTML response as opposed to the encoded “&” entity. I noticed this because it was flagged by the HTML Validator plug-in for Firefox.

    My attempts to set up a rewrite rule for this situation haven’t been successful so I’m wondering if I’m doing something wrong here. The rewrite rule is taking a single ‘&’ character and converting it to ‘&’

    The rule is:

    <rewrite inbound=”false” match=”&” substitute=”&”/>

    I’ve also written a custom Processor but that is also yielding the same result. It appears that the rewrite Processor is being called twice, and the second call is the cause of the problem. What am I doing wrong here?


    Hmmm, we’ve been doing a bunch of work (specifically christian has been doing most of the work) on fixing these encoding issues, but it’s possible we’ve still missed something.

    First, which version of PrettyFaces are you using, on which server, and which version of JSF?





    I’m using PrettyFaces 3.2.0 with JSF 1.2 on IBM WAS 7. I just realized some of the entities in my original post were replaced with the ampersand by the forum. The substitute values should have been ‘& amp;’ without the added space.



    Try version 3.3.0-SNAPSHOT





    No luck – the raw ampersands were still in the output HTML. I was able to get a simple re-write rule working though. Unfortunately this doesn’t take into account any other XML/HTML entities embedded in the URL, but it’s sufficient for now.

    <rewrite inbound="false" match="& #38;(?!amp;)" substitute="& #38;amp;"/>

    Note – I had to add spaces after the ‘&’.

    Thanks for looking in to this.


    Thank you very much for reporting this. It really looks like there is something wrong here. Could you open a ticket for this?


    I’ll have a look at this as soon as possible.



    Issue #104 has been opened – thank you.


    Thank you! We will take a look at this as soon as we can!

Viewing 8 posts - 1 through 8 (of 8 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.