1 Reply Latest reply on Feb 19, 2013 6:19 AM by Martin Vitale

    Can't populate the right side of RichFaces 4 pickList backed by Spring Webflow managed Beans

    Martin Vitale Newbie

      I am in the middle of a migration from Richfaces 3.3.3 to Richfaces 4.3.0, which called for a JSF upgrade from 1.2 to 2.1. We are also using Spring Webflow 2.3.2 (upgraded from 2.1.1) for conversation definition. All beans are managed by Spring (no JSF managed beans). Several Richfaces components had to be adjusted for the application to work properly again. The problem I have now concerns the rich:pickList component, which looks like this (I took the showcase example and edited it to depict the problem):



          <rich:pickList id="ownPicklist" value="#{listSelectBean.selectedCapitals}"

             sourceCaption="Available cities" targetCaption="Selected cities"

             listWidth="165px" listHeight="100px">

             <a4j:ajax event="change" execute="@this" render="#{mainBean.dynamicRerenderList}" />

             <f:selectItems value="#{listSelectBean.capitals}" var="capital"

                itemValue="#{capital}" itemLabel="#{capital.name}" />

             <f:converter converterId="CapitalsConverter" />




      Now unlike the showcase example, our ListSelectBean is a Spring bean and is defined like this:




          <bean id="listSelectBean" class="com.xyz.example.bean.ListSelectBean" scope="request" />



      The custom converter is registered in the faces-config.xml:









      As you can see we have an ajax event handler attached to the pickList, which dynamically calculates a list of components to be rerendered depending on the selected value(s) from the list. This list also contains the pickList itself, which normally has to be rerendered with much less elements (mutual exclusion) to select from. The ajax response I get contains the full source list, but the target list is empty.

      Now to the problem:

      When I select an element from the left side it jumps to the right side and immediately back again.

      I debugged the issue and learned that all the getters and setters of the listSelectBean are invoked correctly as different JSF phases are run through. The same example with JSF managed, request scoped beans works fine (which is in the Richfaces showcase), also with the ajax rerender on the component itself. I suspect a problem with the bean handling in Spring (Webflow). But I can't pinpoint it. Any help will be highly appreciated.