Seam conversation propogation issue
Arshad Mahmood Apr 9, 2009 8:45 AMHi,
I have a bean that represents a hierarchical relationship (i.e. it points to itself). Think of it as representing a category/sub-category type relationship.
I have view say /views/viewCategory.xhtml, that views a specific bean in the hierarchy. This views shows the current bean at the top, and any child beans as a list at the bottom. There three buttons, to edit the current bean, create a new child or cancel. The purpose of the cancel button is to take us back up the hierarchy to view the parent (and so on).
The view viewCategory.xhtml, uses two components as categoryHome and category (both held in conversation scope). The categoryHome is used to fetch the current instance, and category is an alias for categoryHome.instance (just like the open18 example in Dan Allen's book).
I am having a real problem with the cancel button. Whenever, I cancel it still shows me the old bean. I know the cancel has happened becauce if I output categoryHome.instance.id then I get the correct id, but the data in category is still the old bean.
This looks like an ideal candidate for <end-conversation before-redirect="true" />, I have tried that in vain. I know this is a conversation issue, because if I reload the page then it shows the correct data for "category" (and also if I change the scope of "category" to event).
My pages.xml navigation is as follows
<page view-id="/views/viewCategory.xhtml">
<param name="categoryId" value="#{categoryHome.id}" />
<navigation from-action="action">
<rule if="#{category.parent != null}">
<end-conversation before-redirect="true" />
<redirect view-id="/views/viewCategory.xhtml">
<param name="categoryId" value="#{category.parent.id}" />
</redirect>
</rule>
<rule if="#{category.parent == null}">
<end-conversation before-redirect="true" />
<redirect view-id="/views/index.xhtml" />
</rule>
</navigation>
</page>
It seems as though end brefore redirect is not being honoured if I redirect to the same view.
Can anybody help explain what is going on?
I have a bean that represents a hierarchical relationship (i.e. it points to itself). Think of it as representing a category/sub-category type relationship.
I have view say /views/viewCategory.xhtml, that views a specific bean in the hierarchy. This views shows the current bean at the top, and any child beans as a list at the bottom. There three buttons, to edit the current bean, create a new child or cancel. The purpose of the cancel button is to take us back up the hierarchy to view the parent (and so on).
The view viewCategory.xhtml, uses two components as categoryHome and category (both held in conversation scope). The categoryHome is used to fetch the current instance, and category is an alias for categoryHome.instance (just like the open18 example in Dan Allen's book).
I am having a real problem with the cancel button. Whenever, I cancel it still shows me the old bean. I know the cancel has happened becauce if I output categoryHome.instance.id then I get the correct id, but the data in category is still the old bean.
This looks like an ideal candidate for <end-conversation before-redirect="true" />, I have tried that in vain. I know this is a conversation issue, because if I reload the page then it shows the correct data for "category" (and also if I change the scope of "category" to event).
My pages.xml navigation is as follows
<page view-id="/views/viewCategory.xhtml">
<param name="categoryId" value="#{categoryHome.id}" />
<navigation from-action="action">
<rule if="#{category.parent != null}">
<end-conversation before-redirect="true" />
<redirect view-id="/views/viewCategory.xhtml">
<param name="categoryId" value="#{category.parent.id}" />
</redirect>
</rule>
<rule if="#{category.parent == null}">
<end-conversation before-redirect="true" />
<redirect view-id="/views/index.xhtml" />
</rule>
</navigation>
</page>
It seems as though end brefore redirect is not being honoured if I redirect to the same view.
Can anybody help explain what is going on?