4 Replies Latest reply on Aug 28, 2008 3:16 AM by ilya_shaikovsky

    Form actions with Richfaces

    evguen

      Hello,

      I am currently trying RichFaces 3.1.6 and I spend a lot of time with a big deal with form action.

      Let's say I have a form like this :

      <h:form>
       <h:commandButton action="#{supplierSelection.actionUpdate}"
       value="Click here"></h:commandButton>
       <h:inputText value="#{supplierSelection.name}"></h:inputText>
       <h:outputText value="#{supplierSelection.name}"></h:outputText>
      </h:form>
      

      This works fine ! When I click the button, then the entered text is displayed. In the debugger I see that actionUpdate() action is called.

      But when I add a listShuttle component, the actionUpdate() action is not called any more !

      <h:form>
       <h:commandButton action="#{supplierSelection.actionUpdate}"
       value="Click here"></h:commandButton>
       <h:inputText value="#{supplierSelection.name}"></h:inputText>
       <h:outputText value="#{supplierSelection.name}"></h:outputText>
      
       <%/* New part here */%>
       <rich:listShuttle
       sourceValue="#{supplierSelection.selection.freeItems}"
       targetValue="#{supplierSelection.selection.items}" var="items"
       listsHeight="400"
       sourceListWidth="250" targetListWidth="250"
       converter="listShuttleconverter">
       <rich:column>
       <h:outputText value="#{items.label}"></h:outputText>
       </rich:column>
       </rich:listShuttle>
      </h:form>
      



      When I click the button, nothing happens. In the debugger I see that method getSelection() is called, but the actionUpdate() action is not called!

      I do not know anymore where to look at !
      Please, would you have any advice to give ?

      Thanks a lot !

      PS : here is faces-config.xml

      
      <faces-config>
       <application>
       <view-handler>
       org.apache.myfaces.tomahawk.application.jsp.JspTilesViewHandlerImpl
       </view-handler>
       </application>
       <managed-bean>
       <managed-bean-name>supplierSelection</managed-bean-name>
       <managed-bean-class>
       com.test.tiles.SupplierSelection
       </managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
       <converter>
       <converter-id>listShuttleconverter</converter-id>
       <converter-class>
       com.test.tiles.supplier.Converter
       </converter-class>
       </converter>
      </faces-config>
      



        • 1. Re: Form actions with Richfaces
          evguen

          I would like to add that if I9 put the code with listShuttle component outside of the form, then the component works fine... the trouble is just that the selected items from the list are of course not updated...

          Any idea ?

          • 2. Re: Form actions with Richfaces

            In jsf, action is not invoked if validation or update model phase is failed. Based of the behavior you describe, you have such problem with shuttle.
            I did not see <rich:messages /> in your snippet. How do you know, you have no error during the form submit?

            • 3. Re: Form actions with Richfaces
              evguen

              Hello SergeySmirnov,

              You are absolutly right !
              This tag displays me the following message :

              Validation Error: Value xxx is not valid
              


              Now, I found the origin of my trouble.

              Thanks a lot !

              • 4. Re: Form actions with Richfaces
                ilya_shaikovsky

                do not forget to define converter for list shuttle objects and implement equals and hasCode methods in this objects.