4 Replies Latest reply on Jun 20, 2011 8:50 AM by ginc

    Implementing of Post/Redirect/Get Pattern in richfaces 4

    ginc

      Hi there,

       

      i would like to implement the Post/Redirect/Get Pattern (http://en.wikipedia.org/wiki/Post/Redirect/Get) into my application in order to prevent double submits and annoying refresh messages like "To display this page, Firefox must send information that will repeat any action (such as a search or order confirmation) that was performed earlier."

       

      Before I upgraded to jsf 2 and richfaces 4 I have used the filter from balusc (http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html) to solve this problem.

      Unfortunetely it does not work with richfaces 4 anymore. When using this filter'oncomplete' does not work for instance..

       

       

      So my question is, how do I implement this pattern in order to work correctly?

       

      Thanks in advance.

       

      Gregor

        • 1. Re: Implementing of Post/Redirect/Get Pattern in richfaces 4
          lfryc

          This would be great article to you: http://www.warski.org/blog/?p=185

           

          You can find there many choices, just select most appropriate...

          1 of 1 people found this helpful
          • 2. Re: Implementing of Post/Redirect/Get Pattern in richfaces 4
            ginc

            Thanks for that hint. I believe this is a way to get around this problem too..

            But I was wondering if there is a way to handle this post get redirect via a filter.

             

            So instead of handling it at the richfaces/jsf layer, i would like to have a servlet filter take care about it, one layer below.

            Therefore my question, is that possible? If yes, how?

            • 3. Re: Implementing of Post/Redirect/Get Pattern in richfaces 4
              ginc

              How about a PhaseListener?

               

              Is it possible to implement this pattern as a phaseListener, rathern than handling this issue in business layer?!

               

              I would be actually fine with this implementation here:balusc (http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html)

              but it does not work with richfaces 4, so what would be needed to get changed in order to work?

              • 4. Re: Implementing of Post/Redirect/Get Pattern in richfaces 4
                ginc

                I have tried now to solve this issue via jsf navigation rules and its redirect.

                 

                <navigation-rule>

                        <from-view-id>*</from-view-id>

                        <navigation-case>

                            <from-outcome>main</from-outcome>

                            <to-view-id>/main.xhtml</to-view-id>

                          <redirect />  

                     </navigation-case>

                    </navigation-rule>

                 

                It does do its job correctly, no doubt, but in my case this solution does not work, since i use oncomplete to execute some js and if the redirect is on, this js never gets updated correctly because it got redirected before.

                 

                So the question now ist, how can I redirect from post to get on the server side without using client side redirect?

                 

                thanks.