12 Replies Latest reply on Apr 27, 2007 3:30 PM by edbras1

    actiopnParam not work in nested tag inside a repeater :(

    edbras1

      I realy don't understand why my action param isn't called.
      Any idea:

       <a4j:commandLink action="#{vSubscriptionsOverview.selectAuthorization}" value="Rechten"
       rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
       reRender="details">
       <a4j:actionparam value="authorization"
       assignTo="#{vSubscriptionsOverview.selectedState}" />
       </a4j:commandLink>
      


      I was experimenting a bit and found out that it doesn't work as it apears in a <a4j:repeat />, just like in the examples.
      What I have: I show a list of items and then expand on of them when selected to show the details. The details has a little menu with these commandlink tags.
      If I use the code above outside the repeat it works.
      I also use the actionparam in other places outside a repeater, and that also works.
      Any idea's how to make this work?
      BTW: I work witht the snapshot of 20 april 2007.

      CHeers,
      Ed




        • 1. Re: actiopnParam not work in nested tag inside a repeater :(
          edbras1

          I did some more testing, and found out some interesting...
          I now just changed the command link to:

           <a4j:commandLink action="#{vSubscriptionsOverview.selectAuthorization}" value="Rechten"
           rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
           reRender="details">
           </a4j:commandLink>
          


          The command link above is part of a menu of three command links.
          So I just kicked out the action param, and made specific action method for every choice... Less elegant... but I thought that should work...
          The action always returns null and sets a state property that is used in the part below that is part o fthe details panel that is rerendered (just like in the repeater example).
          However, if one of the included xhtml files below contains a checkbox, it goes wrong:
           <h:selectBooleanCheckbox value="#{wizard.bla}" />
          

          What happens is: suppose that the Other xhtml (see below) contains the above checkbox.
          When I select other in the menu, I get this other xhtml rendered. If I then select another menu item, nothing happens anymore :(, that is: the action of the command links isn't called anymore.
          So I can switch xhtml files as long a I don't choose (through the menu) a xhtml file that doesn't contain the checkbox, but as soon as I choose a xhtml file that contains the checkbox, it goes wrong and no action will be called anymore on the backing bean..
          Very strange behavior and don't see any way of debugging it...
          Please some advice?


           <ui:define name="midMainItem">
           <h:panelGroup rendered="#{vSubscriptionsOverview.selectedState eq 'general'}">
           <ui:include src="subscriptionFormGeneral.xhtml">
           <ui:param name="prop" value="#{props}" />
           <ui:param name="wizard" value="#{vSubscriptionsOverview}" />
           </ui:include>
           </h:panelGroup>
           <h:panelGroup rendered="#{vSubscriptionsOverview.selectedState eq 'authorization'}">
           <ui:include src="subscriptionFormAuthorization.xhtml">
           <ui:param name="prop" value="#{props}" />
           <ui:param name="wizard" value="#{vSubscriptionsOverview}" />
           </ui:include>
           </h:panelGroup>
           <h:panelGroup rendered="#{vSubscriptionsOverview.selectedState eq 'other'}">
           <ui:include src="subscriptionFormOther.xhtml">
           <ui:param name="prop" value="#{props}" />
           <ui:param name="wizard" value="#{vSubscriptionsOverview}" />
           </ui:include>
           </h:panelGroup>
           </ui:define>
          


          • 2. Re: actiopnParam not work in nested tag inside a repeater :(
            edbras1

            Solved it... :(

            Was a stupid thing...: I forgot the messages box of the checkbox so didn't see the extual mistake, that is: a setter was missing :( beebbebbee..

            HMMMM,
            Ed

            • 3. Re: actiopnParam not work in nested tag inside a repeater :(
              edbras1

              Hmmmmm, I was a bit to quick.
              I solved part of the problem, that the action wasn't called anymore.
              BUttt.. I still have my original problem: the actionParam isn't called.
              Ff I copy the commandLink code with the nested actionparam outside the repeater, it works perfect..
              If you have any idea, why this is, please let me know.

              • 4. Re: actiopnParam not work in nested tag inside a repeater :(

                if validation phase is failed, the actionparam will not update the bean. So, check you have no validation error during the request.

                • 5. Re: actiopnParam not work in nested tag inside a repeater :(
                  edbras1

                  He Sergey,

                  Thanks for the tip.
                  I looked into it, as the commandLinks are part of a bigger form, but still don't seem to get it to work. I also played with the immediate property but that also had no effect.
                  I made it a nested form now as listed below. I suppose that it will then only submit the nested form, or will it also list the parent form.
                  I think not, but even then I think it would pass the validation phase now as I deleted the other parent form content.

                  Please some more help?
                  BTW: The actions in the commandLinks below always return null. I just want to set a property and rerender a part of the screen. A kind of (ajax) Tab panel functionality.

                   <h:form>
                   <a4j:commandLink action="#{vSubscriptionsOverview.selectGeneral}"
                   value="Algemeen"
                   rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
                   reRender="details" immediate="true" ajaxSingle="true">
                   <a4j:actionparam value="general"
                   assignTo="#{vSubscriptionsOverview.selectedState}" />
                   </a4j:commandLink>
                  
                   <a4j:commandLink
                   action="#{vSubscriptionsOverview.selectAuthorization}"
                   value="Rechten"
                   rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
                   reRender="details" immediate="true" ajaxSingle="true">
                   <a4j:actionparam value="authorization"
                   assignTo="#{vSubscriptionsOverview.selectedState}" />
                   </a4j:commandLink>
                  
                   <a4j:commandLink action="#{vSubscriptionsOverview.selectOther}"
                   value="Overige"
                   rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
                   reRender="details" immediate="true" ajaxSingle="true">
                   <a4j:actionparam value="authorization"
                   assignTo="#{vSubscriptionsOverview.selectedState}" />
                   </a4j:commandLink>
                   </h:form>
                  
                  


                  • 6. Re: actiopnParam not work in nested tag inside a repeater :(
                    edbras1

                    Any ideas?

                    • 7. Re: actiopnParam not work in nested tag inside a repeater :(

                      What does it mean "nested form" in you case.

                      > rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"

                      What the scope #{vAuthen} has ?

                      • 8. Re: actiopnParam not work in nested tag inside a repeater :(
                        edbras1

                        He Sergey,

                        Thanks for your answer.
                        It has a session scope.

                        It's defined in Spring, see below:

                         <!-- ============================================================================= -->
                         <!-- Authentication view bean -->
                         <!-- ============================================================================= -->
                         <bean id="vAuthen"
                         class="com.bla.view.impl.ViewAuthenticationDefault"
                         init-method="init" parent="vWeb" scope="session">
                         <property name="handerLogin" ref="vHandlerLogin" />
                         <property name="loginListeners">
                         <list>
                         <ref bean="vAuthor" />
                         <ref bean="vUserSettings" />
                         <ref bean="vTrafficInfoNavigation" />
                         <ref bean="vSystemPropsOverview" />
                         </list>
                         </property>
                         </bean>
                        
                        


                        • 9. Re: actiopnParam not work in nested tag inside a repeater :(

                          I still cannot see the reason.
                          Could you put phase tracker to your appl. You can use:
                          http://www.jsftutorials.net/faces-config/phaseTracker.html

                          What phases the lifecycle passes when you press the button.

                          • 10. Re: actiopnParam not work in nested tag inside a repeater :(
                            edbras1

                            He Sergey,

                            I put in the phase listeners and got the following output (I copied the code into my own phase listener as I am using java 1.4):

                            PhaseListenerLogin - BEFORE RESTORE_VIEW(1)
                            PhaseListenerLogin - AFTER RESTORE_VIEW(1)
                            PhaseListenerLogin - BEFORE APPLY_REQUEST_VALUES(2)
                            PhaseListenerLogin - AFTER APPLY_REQUEST_VALUES(2)
                            PhaseListenerLogin - BEFORE RENDER_RESPONSE(6)
                            PhaseListenerLogin - AFTER RENDER_RESPONSE(6)
                            


                            I am missing the Validation phase which I think is correct as I made the commandLink immediate.

                            Any idea's ??

                            Cheers,
                            Ed

                            • 11. Re: actiopnParam not work in nested tag inside a repeater :(

                              you missing not only the validation phase, but the update phase where a4j:actionparam is applied.

                              So, your application works as expected.

                              Do you have another problem we can you help with ?

                              • 12. Re: actiopnParam not work in nested tag inside a repeater :(
                                edbras1

                                He Sergey,

                                Thanks for your answer.

                                I think this is the output you are looking for:

                                PhaseListenerLogin - BEFORE RESTORE_VIEW(1)
                                PhaseListenerLogin - AFTER RESTORE_VIEW(1)
                                PhaseListenerLogin - BEFORE APPLY_REQUEST_VALUES(2)
                                PhaseListenerLogin - AFTER APPLY_REQUEST_VALUES(2)
                                PhaseListenerLogin - BEFORE PROCESS_VALIDATIONS(3)
                                PhaseListenerLogin - AFTER PROCESS_VALIDATIONS(3)
                                PhaseListenerLogin - BEFORE UPDATE_MODEL_VALUES(4)
                                PhaseListenerLogin - AFTER UPDATE_MODEL_VALUES(4)
                                PhaseListenerLogin - BEFORE INVOKE_APPLICATION(5)
                                PhaseListenerLogin - AFTER INVOKE_APPLICATION(5)
                                PhaseListenerLogin - BEFORE RENDER_RESPONSE(6)
                                PhaseListenerLogin - AFTER RENDER_RESPONSE(6)
                                


                                With the following xhtml menu code (removed the immediate ;) ):

                                 <a4j:commandLink
                                 action="#{vSubscriptionsOverview.selectPageGeneral}"
                                 value="Algemeen"
                                 rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
                                 reRender="details" ajaxSingle="true">
                                 <a4j:actionparam value="general"
                                 assignTo="#{vSubscriptionsOverview.selectedState}" />
                                 </a4j:commandLink>
                                
                                 <a4j:commandLink
                                 action="#{vSubscriptionsOverview.selectPageAuthorization}"
                                 value="Rechten"
                                 rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
                                 reRender="details" ajaxSingle="true">
                                 <a4j:actionparam value="authorization"
                                 assignTo="#{vSubscriptionsOverview.selectedState}" />
                                 </a4j:commandLink>
                                
                                 <a4j:commandLink action="#{vSubscriptionsOverview.selectPageOther}"
                                 value="Overige"
                                 rendered="#{vAuthen.memberAdmin or vAuthen.memberSuper}"
                                 reRender="details" ajaxSingle="true">
                                 <a4j:actionparam value="other"
                                 assignTo="#{vSubscriptionsOverview.selectedState}" />
                                 </a4j:commandLink>
                                
                                


                                Sorry, but it's still not working. The action is called but the actionparam isn't fired.