6 Replies Latest reply on Nov 5, 2008 5:20 AM by ilya_shaikovsky

    rich:listShuttle rerendering problem selectOneListbox onchan

    sansaric

      Hi everyone,

      I am using a rich:listShuttle component with a selectOneListbox on the same page. The first time the page loads, the listShuttle component renders fine and I can move objects from one side to the other the way it was intended. However, after changing the value of the selectOneListbox, which has a a4j:support tag attached to it with an actionListener, I get the following error:

      org.apache.jasper.el.JspPropertyNotFoundException - /rprc/jobMaintenance/dataeditor/notificationEditor.jsp(51,10) '#{users.displayName}' Property 'displayName' not found on type java.lang.String


      I am using MyFaces 1.2.4 with richfaces3.2.2
      Below is code excerpt:
      <rich:panel>
      <h:panelGrid columns="2">
      <h:outputText value="Prototype"/>
       <t:selectOneListbox
       size="1" value="#{dataHandler.currentId}">
       <f:selectItem itemLabel="Photo" itemValue="1"
       <f:selectItem itemLabel="PC" itemValue="2"
       <f:selectItem itemLabel="Assembly" itemValue="3" <a4j:support
       event="onchange"
       actionListener=
       "#{dataHandler.updateDependencies}"
       reRender="NotificationEditorOutputPanel" />
       </t:selectOneListbox>
       </h:panelGrid>
       <a4j:outputPanel id="NotificationEditorPanel" ajaxRendered="true">
       <rich:listShuttle
       id="NotificationListShuttle"
       sourceValue="#{dataHandler.availableSubscribers}"
       targetValue="#{dataEditingHandler.committedSubscribers}"
       fastOrderControlsVisible="false"
       orderControlsVisible="false"
       var="users"
       sourceCaptionLabel="Available Users"
       targetCaptionLabel="Currently Subscribed Users">
       <rich:column>
       <h:outputText value="#{users.displayName}"/>
       </rich:column>
       </rich:listShuttle>
       </a4j:outputPanel>
       </rich:panel>


      availableSubscribers and committedSubscribers are list of beans which have a string property called displayName.

      Your help resolving this issue is greatly appreciated.

      Thanks,
      Marcel

        • 1. Re: rich:listShuttle rerendering problem selectOneListbox on
          nbelaevski

          Marcel,

          You should define list shuttle converter.

          • 2. Re: rich:listShuttle rerendering problem selectOneListbox on
            sansaric

            Thanks,
            I will try to define the converter as suggested and didn't realize I needed one for a String property in my bean

            • 3. Re: rich:listShuttle rerendering problem selectOneListbox on
              khaled_288

              try to add a converter for the listShuttle tag.

              the converter might be something link this:

              public class SubscriberConverter implements javax.faces.convert.Converter{
              
               public Object getAsObject(FacesContext context, UIComponent component,
               String value) {
              
               int index = value.indexOf(':');
              
               Subscriber s = new Subscriber();
               s.setId(Integer.valueOf(value.substring(0, index)));
               s.setName(value.substring(index + 1));
              
               return s;
               }
              
               public String getAsString(FacesContext context, UIComponent component,
               Object value) {
              
               Subscriber optionItem= (Subscriber) value;
               return optionItem.getId() + ":" + optionItem.getName();
               }
              
              }


              • 4. Re: rich:listShuttle rerendering problem selectOneListbox on
                sansaric

                Very useful example. Thanks to all who responded.

                • 5. Re: rich:listShuttle update problem with selectOneListbox
                  sansaric

                  I added the converter as suggested in the previous replies and the error originally generated is gone which is great. However, I am trying to use the selectOneListbox (see code snippet below) to update the targetValue list parameter of the listShuttle with a new set of options but is it not happening even though I verified that my actionListener is executing and the list that is bound to the targetValue parameter is getting updated. My backingBean has session scope and contains both the actionListener and the list that drives the targetValue parameter of the listShuttle

                  Any ideas ?

                  Thanks in advance for your help.

                  
                  <rich:panel>
                  <h:panelGrid columns="2">
                  <h:outputText value="Prototype"/>
                   <t:selectOneListbox
                   size="1" value="#{dataHandler.currentId}">
                   <f:selectItem itemLabel="Photo" itemValue="1"
                   <f:selectItem itemLabel="PC" itemValue="2"
                   <f:selectItem itemLabel="Assembly" itemValue="3" <a4j:support
                   immediate="true"
                   event="onchange"
                   actionListener=
                   "#{dataHandler.updateDependencies}"
                   reRender="NotificationEditorOutputPanel" />
                   </t:selectOneListbox>
                   </h:panelGrid>
                   <a4j:outputPanel id="NotificationEditorPanel" ajaxRendered="true">
                   <rich:listShuttle
                   immediate="true"
                   id="NotificationListShuttle"
                   sourceValue="#{dataHandler.availableSubscribers}"
                   targetValue="#{dataEditingHandler.committedSubscribers}"
                   fastOrderControlsVisible="false"
                   orderControlsVisible="false"
                   var="users"
                   sourceCaptionLabel="Available Users"
                   targetCaptionLabel="Currently Subscribed Users">
                   <rich:column>
                   <h:outputText value="#{users.displayName}"/>
                   </rich:column>
                   </rich:listShuttle>
                   </a4j:outputPanel>
                   </rich:panel>
                  


                  • 6. Re: rich:listShuttle rerendering problem selectOneListbox on
                    ilya_shaikovsky

                    your support is immediate so why you expect that new value will be applied before you trying to add new value using action listener? try to use ajaxSingle instead of immediate.