6 Replies Latest reply on May 13, 2007 6:26 PM by vralev

    Loosing the URL parameters between requests

    vralev

      I am looking for a way to keep the GET params between requests (leading to the same page).

      The blog sample app for instance has nice bookmarkable URLs for the posts:
      http://localhost:8080/seam-blog/seam/entry.xhtml;jsessionid=81D2CDB39A995308A2E407B5BB2007A3?blogEntryId=book

      however, when you change the theme it performs another request the url ends up like this:
      http://localhost:8080/seam-blog/seam/entry.xhtml

      Any easy fixes?

        • 1. Re: Loosing the URL parameters between requests
          pmuir

          I think page parameters should do what you are after?

          • 2. Re: Loosing the URL parameters between requests
            robjellinghaus

            The "blogEntryId" *is* a page parameter in the blog example.

            I don't understand the theme stuff well enough to know of any easy way to pass the page parameters along with the theme re-request.

            • 3. Re: Loosing the URL parameters between requests
              pmuir

              It looks like page parameters don't get added if the page is redisplayed (rather than a navigation performed). Gavin really need to look at this.

              • 4. Re: Loosing the URL parameters between requests
                vralev

                Yes, page parameters don't seem to keep it.

                My use case is more common than a theme change. The user is browsing some bookmarkable articles, and if he wants to add a comment he has to log in and stay on the same page. After the log-in the GET params disappear.

                One workaround is to use a4j login action and rerender the the needed parts, which is a bit more complicated (and bugged with richfaces right now).

                • 5. Re: Loosing the URL parameters between requests
                  sammy8306

                  My approach is to cache the parameters in a page scoped component.

                  • 6. Re: Losing the URL parameters between requests
                    vralev

                    After taking a deeper look I figured it out. It needs some navigation defined in pages.xml. For example in the blog demo entry.xhtml page definition should be:

                     <page view-id="/entry.xhtml">
                    
                     <param name="blogEntryId"
                     value="#{blogEntry.id}"/>
                    
                     <action execute="#{entryAction.loadBlogEntry(blogEntry.id)}"/>
                    
                     <navigation from-action="#{themeSelector.select}">
                     <redirect view-id="/entry.xhtml"/>
                     </navigation>
                    
                     </page>
                    


                    It would be possible to automate this in Seam. It needs:

                    entry.setDefaultNavigation(..);
                    


                    in Pages.parseActionNavigation for every page, but I see it's specifically coded to avoid creating this default navigation and may be it's better to leave it that way.