6 Replies Latest reply on Mar 20, 2014 11:30 AM by Ken Clubok

    Nested Conversation End + Redirect

    Cody Lerum Apprentice

      I'm having an issue which nested conversations. I'm using the breadcrumb stragety from the docs and Dan Allen's Seam in Action to provide some navigation.

      From the home page the Ican click on List Organizations which takes them to a list of Organisations. I can click on the organization name which takes them to the organization details shows a list of users. Then I can click edit user which takes me to a page to edit the users information.

      This all works very well and each click starts a new nested conversation. This creates a nice little breadcrumb trail when I'm on the edit user page.

      Organization List > SellMore, Inc. > Edit User

      When I click on the Update button <h:commandButton id="update" value="Update" action="#{userutil.updateUser()}" rendered="#{user.password != null}" />

      it calls

      public void updateUser()

      This ends the outermost converstation (I can see this because my breadcrumb trail gets shorter), but it just reloads the same page I'm on.

      Dan's book says that endAndRedirect will bypass navigation rules but my pages.xml doesn't have anything for that view-id except the description required for the breadcrumbs.

      <page view-id="/admin/edit_user.xhtml">
               <description>Edit User</description>

      I could just use a navigation rule to move to the right page, but I can get to this specific view id a couple different ways and what I really want to do is just redirect to view-id of the outermost conversation. This should just move me back a page.

      Can anyone point me in the right direction?

        • 1. Re: Nested Conversation End + Redirect
          Cody Lerum Apprentice

          OK I've made a little progress.

          1. I had a conversation in the stack which had a null view-id. It was created because the method called on the org_list.xhtml page had an @End(nest=true) and the s:link calling the method had an propagation="nest" is that correct behavior? I pulled the nest on the s:link and now it's working.

          2. I got the redirect working by

               public void updateUser()

          Browsing the source code it doesn't look like there is anything to trigger this with the @End(????), only with injecting the Converstation and calling an endAndRedirect() Is this something that I could potentially make a patch for ie @End(redirect=true) or are their bigger design issues that I'm not seeing since I don't understand all the nuts and bolts.

          • 2. Re: Nested Conversation End + Redirect
            Cody Lerum Apprentice


            Looks like this was considered at the time when endAndRedirect was added.

            • 3. Re: Nested Conversation End + Redirect
              Chris Simons Expert

              It seems that you never received a reply on this topic.

              Just to add my two cents, we ran into a similar problem.

              I worked around it by using pages.xml as the way of beginning and ending conversations.

              So, in the event that you are at a page called:

              updateUser.xhtml, click an action called "updateUser()".

              In the pages.xml for updateUser, the navigation for "updateUser()" would be handled with the something like this...

              <navigation from-action="bean.updateUser()">
              <redirect view-id="somePage.xhtml"/>
              <end-conversation before-redirect="true"/>

              In summary, we found that handling the specific page-level actions in pages.xml helped us enormously with what was initially a lot of headache regarding conversations and breadcrumbs.

              Hope this helps.

              • 4. Re: Nested Conversation End + Redirect
                Cody Lerum Apprentice


                My issue is that I could be going to one of multiple view-id's upon ending the outer conversation.

                • 5. Re: Nested Conversation End + Redirect
                  Tim Evers Master

                  Here is a work around that may or may not work. I havn't tried it but just based on some stuff I've played around with.

                  Change your

                  <redirect view-id="somePage.xhtml"/>

                  to use an EL expression for the view-id... I THINK this might work but not sure.

                  <redirect view-id="#{ConversationEntries.getConversationEntry(Conversation.instance().getParentId()).getViewId()}"/>

                  Anyways, like I said, not tested and this really depends a lot on how you have set up your conversations etc.

                  • 6. Re: Nested Conversation End + Redirect
                    Ken Clubok Newbie

                    This is an old thread, but I recently had to discover the answer for myself.  The correct EL expression is this:


                    <redirect view-id="#{manager.parentConversationViewId}">