How to create nested conversation for <a4j:include> content
skidvd.seamframework.abilsoft.com Apr 30, 2009 5:03 AMHello,
My app has a "<rich:panelMenu>" whose "<rich:panelMenuItem>" member elements cause the reRender of an "<a4j:outputPanel>". The "<a4j:outPutPanel>" contains an <a4j:include> for a viewId that is controlled by the previously selected "<rich:panelMenuItem>".
All of this works just as desired and the <a4:outputPanel> contents get reRendered with the user selected Facelet.
My problem is that I need to start a nested conversation for the first (and only the first) invocation of any given Facelet that will be rendered for a given <rich:panelMenuItem>.
Why, you might ask?
Some of the Facelets in question need to bind to a JSF component. So I use:
@Scope( ScopeType.EVENT )
@Name( "extendedDataTableController" )
public class ExtendedDataTableControllerBean
I subsequently reference this in the Conversation component for each Facelet like:
@In( value="extendedDataTableController", required=false )
protected ExtendedDataTableControllerBean table;
The problem is that different Facelets have different ExtendedDataTables (i.e. different columms, etc). However, as the controllers for those Facelets are Conversation scoped (I want to keep them this way), all Facelets that need to use this JSF binding are referencing the same instance .... not good and quite problematic as you switch between the menuItems/Facelets.
The obvious answer to me seems to be to have each of the menuItems/Facelets running in their own individual nested Conversation... This, I presume, would allow each Conversation to interact with its own 'unique' instance of the JSF binding EVENT scoped object?
However, I cannot seem to force a nested conversation creation in pages.xml or by other means. I tried the following addition (for one of the menuItem controlled Facelet contents) to pages.xml:
<page view-id="/pages/configuration/pagea.xhtml">
<begin-conversation nested="true"/>
<description>Page A</description>
</page>
However, this does not appear to work (verified via output of #{conversationList} - no nested conversation is created I presume because this rule is never 'invoked' as the pagea.xhtml is only referenced via an <a4j:include> in response to a POST on the main page (....there is no navigation or direct link to it, just AJAX include)????
I've also placed @Begin(nested=true) on a @Factory method invoked by the included Facelets; but while this creates the nested conversation, it is invoked/created AFTER the @In injection of the EVENT scoped binding component, so does not solve the issue.
I'm sure there is a way to work around this or a better way to approach it, but as I'm still fairly new to Seam (and Conversations in particular), I'm not sure how.
Any and all help will be greatly appreciated!
TIA!
My app has a "<rich:panelMenu>" whose "<rich:panelMenuItem>" member elements cause the reRender of an "<a4j:outputPanel>". The "<a4j:outPutPanel>" contains an <a4j:include> for a viewId that is controlled by the previously selected "<rich:panelMenuItem>".
All of this works just as desired and the <a4:outputPanel> contents get reRendered with the user selected Facelet.
My problem is that I need to start a nested conversation for the first (and only the first) invocation of any given Facelet that will be rendered for a given <rich:panelMenuItem>.
Why, you might ask?
Some of the Facelets in question need to bind to a JSF component. So I use:
@Scope( ScopeType.EVENT )
@Name( "extendedDataTableController" )
public class ExtendedDataTableControllerBean
I subsequently reference this in the Conversation component for each Facelet like:
@In( value="extendedDataTableController", required=false )
protected ExtendedDataTableControllerBean table;
The problem is that different Facelets have different ExtendedDataTables (i.e. different columms, etc). However, as the controllers for those Facelets are Conversation scoped (I want to keep them this way), all Facelets that need to use this JSF binding are referencing the same instance .... not good and quite problematic as you switch between the menuItems/Facelets.
The obvious answer to me seems to be to have each of the menuItems/Facelets running in their own individual nested Conversation... This, I presume, would allow each Conversation to interact with its own 'unique' instance of the JSF binding EVENT scoped object?
However, I cannot seem to force a nested conversation creation in pages.xml or by other means. I tried the following addition (for one of the menuItem controlled Facelet contents) to pages.xml:
<page view-id="/pages/configuration/pagea.xhtml">
<begin-conversation nested="true"/>
<description>Page A</description>
</page>
However, this does not appear to work (verified via output of #{conversationList} - no nested conversation is created I presume because this rule is never 'invoked' as the pagea.xhtml is only referenced via an <a4j:include> in response to a POST on the main page (....there is no navigation or direct link to it, just AJAX include)????
I've also placed @Begin(nested=true) on a @Factory method invoked by the included Facelets; but while this creates the nested conversation, it is invoked/created AFTER the @In injection of the EVENT scoped binding component, so does not solve the issue.
I'm sure there is a way to work around this or a better way to approach it, but as I'm still fairly new to Seam (and Conversations in particular), I'm not sure how.
Any and all help will be greatly appreciated!
TIA!