Seam-2.3 conversation scope propagation on a4j:ajax event?
mbickel Mar 11, 2013 8:12 AMStill migrating from Seam-2.2 to Seam-2.3 (using RF-4.3.0 here). I have a view that is backed by one conversation-scoped and several session scoped beans. My problem is that my xingManager.authorize() action method is not called because seam doesn't seem to be able to grab the correct conversation bean and save the changes made to the h:selectOneMenu below:
<h:form> <h:selectOneMenu value="#{manager.hint}"> <f:selectItems value="#{listFactory.allHints}" /> <a4j:ajax render="choicePanel" /> </h:selectOneMenu> <a4j:outputPanel id="choicePanel"> <a4j:outputPanel rendered="#{manager.hint == 'LINKEDIN'}"> ... </a4j:outputPanel> <a4j:outputPanel id="xingPanel" rendered="#{manager.hint == 'XING'}"> <a4j:outputPanel rendered="#{!xingManager.authorized}"> <a4j:commandButton action="#{xingManager.authorize}" execute="@form" render="xingPanel" /> </a4j:outputPanel> </a4j:outputPanel> </a4j:outputPanel> </h:form>
When I switch around in the h:selectOneMenu, ajax events are generated and processed just fine. The "choicePanel" gets updated as it should, but on clicking the a4j:commandButton the associated action does not get called. After some hours of debugging I found that manager.hint isn't set to 'XING' in the backing bean when restoring the view (even though it *was* set by the ajax call before).
The corresponding beans are something like this:
@Name("manager") @Scope(ScopeType.CONVERSATION) public class Manager { public HintEnum { LINKEDIN, XING }; private HintEnum hint; // getter and setter }
@Name("xingManager") @Scope(ScopeType.SESSION) public class XingManager { public void authorize() { /* send authorization request to 3rd party API */ } public boolean getAuthorized() { /* query logged in user component */ } }
The listFactory.allHints property just returns all values() of the enum above.
I found that lifting the Manager bean to ScopeType.SESSION "fixed" the issue and the action was called just fine. I deduced that seam failed to notice and restore the conversation, but even manually adding the conversation id to the ajax request didn't help. Since I rely on conversation scope to make tabbed browsing "just work" I'm pretty much stuck with conversation scope. Have I missed something that would make the example work with conversation scope or is going session scope the only option in this case?