5 Replies Latest reply on Jul 1, 2008 5:00 PM by Shervin Asgari

    Bean binding, calls getMethod too much

    Shervin Asgari Master

      Hello. This might not be a seam question, but still I would like to ask you guys this.


      I have a simple textfield which I set in my action class.
      In my xhtml class I have a rich:column which I render if this text field is some value.


      The dataTable (List) has size 2, but still my get method is called around 30 times(!). It should only be called 4 times.


      Why is this do you think? This is the portion of the xhtml code:



      <rich:column rendered="#{searchBevillingManager.fromSoek eq 'Bevillingshaver'}">
              <f:facet name="header"><h:outputText value="Velg"/></f:facet>
              <s:link view="/protected/BevillingSoek.xhtml" value="Choose" action="#{searchBevillingManager.chooseBevillinghaver}"><f:param name="organisasjonId" value="#{org.organisasjonId}"/>
              </s:link>
      </rich:column>
      <rich:column rendered="#{searchBevillingManager.fromSoek eq 'Omsetningssted'}">
              <f:facet name="header"><h:outputText value="Choose"/></f:facet>
              <s:link view="/protected/BevillingSoek.xhtml" value="Velg" action="#{searchBevillingManager.chooseOmsetningssted}">
              <f:param name="organisasjonId" value="#{org.organisasjonId}"/>
              </s:link>
      </rich:column>


        • 1. Re: Bean binding, calls getMethod too much
          Shervin Asgari Master

          This is the DEBUG code showing how many times the getFromSoek() method is called.


          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted
          01 Jul 08 13:56:54, DEBUG  alkohol.register.session.search.SearchBevillingManagerAction:getFromSoek:576 getFromSoek: Omsetningssted

          • 2. Re: Bean binding, calls getMethod too much
            Mikael Andersson Master

            Add a debug phase listener, then you will see in which lifecycles the getter is called (search this forum for information about this).


            This will help you see what is going on when the getter is called.


            Off the top of my head I can't figure out where those 30 calls come from but JSF calls getters a lot more that you think and in phases you might not suspect.

            • 3. Re: Bean binding, calls getMethod too much
              Shervin Asgari Master

              I have a phase listener. Its called on
              INFO: BEFORE RENDER RESPONSE 6
              which seems correct. So I have no idea why it is still called so many times.

              • 4. Re: Bean binding, calls getMethod too much
                Mikael Andersson Master

                Is the phase listener enabled for all phases (ANY) ?


                I don't know either why it gets called that many times in the render response phase, I would put a break point in the getter and look at the call stack.


                fyi:


                I tried implementing conditional rendering of columns using the rendered attribute a while ago, but gave up. When there were a couple of hundred rows the page was dead slow.

                • 5. Re: Bean binding, calls getMethod too much
                  Shervin Asgari Master

                  Yes it is enabled for all.
                  It is only before render response I get all these gets. I don't know why. For know I just live with it, but it would be nice to know why.