8 Replies Latest reply on Apr 17, 2008 11:40 AM by nbelaevski

    reRender issue: characters escaped

    shakenbrain

      I originally raised this issue in the seam forum (http://www.seamframework.org/Community/RerenderProblemWithFparamInSlink#comment16607). I didn't do a very good job describing the problem, and I think it's an Ajax4JSF issue, not a seam one.

      In a nutshell, the <s:link> seam component does not render properly after an Ajax4JSF reRender event when it contains more than one <f:param> tag. The ampersand character is always escaped- '&' is rendered as '&-#-3-8' (minus the dashes, of course).

      Here's a simple way to reproduce the problem. Take the seam-booking app from the seam examples and edit view/main.xhtml. Add a couple of arbitrary parameter tags to the 'View Hotel' link (at or near line 68):

      <s:link id="viewHotel" value="View Hotel" action="#{hotelBooking.selectHotel(hot)}">
       <f:param name="key1" value="1"/>
       <f:param name="key2" value="2"/>
      </s:link>


      Deploy the app, login, click the 'Find Hotels' button, and look at the 'View Hotel' links.

      I tried upgrading to the latest version of JSF RI and tried using RichFaces 3.1.3, 3.1.4 and 3.2- all with the same result.

      This is a show-stopper for me, so any help is greatly appreciated.




        • 1. Re: reRender issue: characters escaped
          ilya_shaikovsky

          Just tried next code

          <h:form id="menu">
           <a4j:commandButton reRender="panel"></a4j:commandButton>
           <a4j:outputPanel id="panel">
           <s:link id="viewHotel" value="View Hotel"
           action="#{menucomponent.printParams}">
           <f:param name="key1" value="1" />
           <f:param name="key2" value="2" />
           </s:link>
           </a4j:outputPanel>
           </h:form>
          

          and

          public void printParams() {
           System.out.println(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("key1"));
           System.out.println(FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("key2"));
           }


          before and also after reRendering s:links prints me to console

          before link reRendered
          15:44:18,110 INFO [STDOUT] 1
          15:44:18,110 INFO [STDOUT] 2
          after link reRendered
          15:44:32,929 INFO [STDOUT] 1
          15:44:32,929 INFO [STDOUT] 2



          • 2. Re: reRender issue: characters escaped
            ilya_shaikovsky

            tried under 3.2.1 snapshot.. So check please under 3.2.0 SR1

            • 3. Re: reRender issue: characters escaped
              shakenbrain

              Ilya- thanks for taking a look at this. I'll try the 3.2.0 SR1 when I get to work. But unless I'm missing something in your response, the issue isn't with the values of the parameters changing- they have always been correct. The issue is with the parameter separator character ('&') in the http link generated by the s:link tag. After re-rendering, it is no longer the '&' character, but the escaped version of it.

              Instead of:

              <a href="/page.html?param1=1&param2=2">


              we get

              <a href="/page.html?param1=1&#38;param2=2">


              Tom


              • 4. Re: reRender issue: characters escaped
                shakenbrain

                When previewing this post, the escaped version displays fine, but after it displays 'unescaped' after submitting it. I'll try this again:

                Instead of

                <a href="/page.html?param1=1&param2=2">


                we get

                <a href="/page.html?param1=1&-#-3-8-;param2=2">


                I added the dashes (-) just for the purposes of this post.

                • 5. Re: reRender issue: characters escaped
                  shakenbrain

                  Ilya- I apologize- I think I may have misunderstood your post. I'll try the latest version when I get to work (and am more awake). Tom

                  • 6. Re: reRender issue: characters escaped
                    nbelaevski

                    Hello,

                    I do not see the issue. Here is my link:

                    http://localhost:8080/seam-booking/main.seam?key1=1&dataModelSelection=hot%3Ahotels%5B0%5D&key2=2&cid=60&actionMethod=main.xhtml%3AhotelBooking.selectHotel%28hot%29


                    Seam 2.0.1/RichFaces 3.2.0.SR1/JBoss 4.2.1.GA

                    • 7. Re: reRender issue: characters escaped
                      nbelaevski

                      For the following code:

                      <h:form id="menu123">
                       <a:commandButton reRender="panel123" value="rerender"/>
                       <a:outputPanel id="panel123">
                       <s:link id="viewHotelabc" value="View Hotel"
                       >
                       <f:param name="key1" value="1" />
                       <f:param name="key2" value="2" />
                       </s:link>
                       </a:outputPanel>
                       </h:form>
                      


                      I get:
                      http://localhost:8080/seam-booking/main.seam?key1=1&key2=2&cid=94


                      • 8. Re: reRender issue: characters escaped
                        nbelaevski

                        Clarification: I meant that I couldn't reproduce the issue