4 Replies Latest reply on Oct 6, 2005 2:52 PM by rdewell

    Need to "reset" a conversation bean?

    rdewell

      I'm grasping at straws on this one. I have a generic bean + view that is responsible for displaying and updating a number of different entity types. I use f:param inside an h:commandLink to pass in two variables: entityId and entityName.

      Then, in my action method "view()", I do something like:

      entityId = (String) facesContext.getExternalContext().getRequestParameterMap().get("entityId");
      entityName = (String)facesContext.getExternalContext().getRequestParameterMap().get("entityName");

      And, then I load the entity from the EntityManager, etc. All of this works fine of course.

      Picture all of these commandLink's with f:param's in a list representing several different entities. Click the first one and everything is fine. Seam reports "beginning long running conversation". The view displays perfectly.

      Navigating back to the entity list, and another click on any other entity displays something like:

      Restoring conversation with id: 4
      begining long running conversation

      But, and we're finally to the problem, it just redisplays the same entity! Put differently, when view() is called this second time and I access the getRequestParameterMap()'s values, I see the exact same values that I "saw" when the conversation was started on the very first entity link that was clicked. (Verified through debugging)

      Now granted, that's pretty slick functionality... but I need a way to bypass that. In essence if view() is called and there is a current conversation going on, I need to end/cancel that conversation first, and then have view() work as normal and see the "new" information in getRequestParameterMap, not the old information from the original conversation.

      I need this to be a conversation bean, because it is possible to update the entity being viewed.

      Any ideas?

      Ryan

        • 1. Re: Need to
          gavin.king

          Without code it is a bit hard to understand what you are doing.

          How is this different to the list view in the booking demo app?

          • 2. Re: Need to
            rdewell

            That's a good question. I guess the main difference is that there is a one-to-one between the bean and the entity and that the bean is a viewer/editor for. The list the entity came out of is entirely independent and doesn't exist at this point. The bean is detached from the list in other words.

            To ask a more pointed question, does it make sense that the second time I access getRequestParameterMap() in my action method (in a completely separate request), that I see the same values that occurred on the request that first started a conversation with that bean? That's what is happening, and I'm trying to get around it.

            FYI, facesContext is injected, intercept is always, and getRequestParameterMap is being read when the action method view() is called.

            Ryan

            • 3. Re: Need to
              gavin.king

               


              To ask a more pointed question, does it make sense that the second time I access getRequestParameterMap() in my action method (in a completely separate request), that I see the same values that occurred on the request that first started a conversation with that bean? That's what is happening, and I'm trying to get around it.


              No, this does not make any sense at all.

              • 4. Re: Need to
                rdewell

                Alright. I incorrectly assumed that this is something that Seam was intentionally doing. I'll try to shed more color on this behavior then in a future post.

                Ryan