3 Replies Latest reply on Jan 5, 2011 9:00 AM by ilya40umov

    Why does disabled/rendered break A4j:commandLink

    jovincen

      Hi,

       

      I have an a4j:commandLink where I set the disabled property based on the status of a bean in rest scope (a seam conversation that is not long running).

       

      If I display the boolean property with outputText it displays the correct value.

       

      I'm assuming that when the post is made the link is re-evaluated by faces as disabled (because the backing bean has not been correctly setup), so the click event is ignored.

       

      Ie. it is enabled in the browser. However clicking it does not call the event on the server.

       

      I have hiddenInput fields that should set properties on the backing bean to ensure it is in the correct state.

       

      Any ideas?

       

      Cheers,

      Jon

        • 1. Re: Why does disabled/rendered break A4j:commandLink
          ilya40umov

          You need to extend a life time of your bean. It should live at least until user works with the same page.

          Try a4j:keepAlive tag. Or make your bean page(JSF 2.0 already supports this) or session scoped.

          • 2. Re: Why does disabled/rendered break A4j:commandLink
            jovincen

            eep.. is that the only way to do it?

             

            I'd prefer to kill off the server beans...

            • 3. Re: Why does disabled/rendered break A4j:commandLink
              ilya40umov

              1) I guess you can save only this flag into session. You shoud define it separetly in sessionScope with some name #{someFlag} and then use managed-property to inject in into bean

               

               

              <managed-property>
                 <property-name>updateDeviceBean</property-name>
                 <value>#{updateDeviceBean}</value>
                </managed-property>

              <managed-property>

                 <property-name>someFlag</property-name>

                 <value>#{someFlag}</value>

                </managed-property>

               

              2) I guess you can always find a workaround and try to use Filter/PhaseListener in order to set this option before JSF will reread it from your request scoped bean. But it looks like a bad way out for me.