4 Replies Latest reply on Jun 13, 2013 10:41 AM by abmashile

    component reRendered before action execution

      Hello, I have the following problem:


      I have an a4j:commandButton with an action an a reRender:


      <a4j:commandButton
           action="#{bean.doAction()}"
           oncomplete="Richfaces.showModalPanel('ControlLFMP')"
           reRender="EditControlLFUC"
           value="Edit Control" />



      As I understand this, the EditControlLFUC component should be reRendered after the doAction is executed.
      My problem is that the component is been reRendered before the doAction is executed and because of this the values of the EditControlLFCU component are not correct.


      Could anyone help me?


      Regards,
      Chiara



        • 1. Re: component reRendered before action execution
          kragoth

          You might need to post a bit more of your code as the problem you are describing is very unusual. The lifecycle dictates that the application invoke stage happens before the render phase and from the little reading I've done what is happening to you just shouldn't happen.


          What makes you sure that the rerender is happening before the action? Have you put a breakpoint in your action method and checked this? What type of component is EditControlLFUC


          Does your action method do any fancy async stuff or anything like that? Are you using an ajax queue? Are there other ajax calls that could be interfering with this one?

          • 2. Re: component reRendered before action execution
            huionn

            JSF has 6 phases:
               1. Restore view
               2. Apply request values
               3. Process validations
               4. Update model values
               5. Invoke application
               6. Render response


            your bean.doAction() will be invoked during Invoke application phase.
            your EditControlLFUC will be reRendered in Render response phase.


            However, original value of EditControlLFUC will also be called during Restore view phase to rebuild components tree.

            • 3. Re: component reRendered before action execution
              abmashile

              My a4j:commandButton was inside a panelMenuItem and to resolve the issue I disabled it:

              <rich:panelMenuItem disabled="true">

                   <a4j:commandButton
                   action="#{bean.doAction()}"
                   oncomplete="Richfaces.showModalPanel('ControlLFMP')"
                   reRender="EditControlLFUC"
                   value="Edit Control" />

              </rich:panelMenuItem>

              • 4. Re: component reRendered before action execution
                abmashile

                some issues are a result of nested form tags and controls outside the form