1 Reply Latest reply on Oct 1, 2009 12:18 PM by José Ventura

    a4j:repeat is always "processed" on the server side

    José Ventura Newbie

      I have a question regarding the processing (rendering) of some portions of a page when an Ajax request happens. I'm using RichFaces 3.3.1.GA and Facelets 1.1.4. I'll explain my issue:

      I have a suggestion box which is working fine:

      <a4j:form>
       <h:inputText id="myText"/>
       <rich:suggestionbox for="myText" ... />
      </a4j:form>
      


      On the same page, but on a completely different form, I have a simple iteration component, using:

      (actually I think this is outside any forms)
      <a4j:repeat value="#{MyBean.myObjects}">...</a4j:repeat>
      


      MyBean has a method annotated with @PostConstruct, that loads some objects from the database. What I am experiencing is that every time the suggestion box requests items, that PostConstruct method is invoked.

      I know that MyBean is not being kept alive (no a4j:keepAlive for it on this page), so I think it is being instantiated every time. This is fine, but what I'm thinking is why that portion of the page is being rendered again (it's nowhere near the suggestion box).

      First, I thought it might be updating the entire page. I tried setting the "process" attribute to contain only the suggestion box id. I also tried adding the textfield's ID to that attribute. The repeat was still being rendered.

      Then I tried setting the "reRender" attribute with only the suggestion box ID. Still nothing: that a4j:repeat keeps being processed.

      My question is: is there a way to keep that portion of the page from re-evaluating at every Ajax request? Or is it normal? Maybe it is always rendered on the server, and all the reRender attributes only tell the client to disregard certain pieces of the Ajax response?

      Thanks in advance!
      - Joseph

        • 1. Re: a4j:repeat is always
          José Ventura Newbie

          I think I found my answer. I used the "limitToList" property:

          <a4j:form>
           <h:inputText id="myText"/>
           <rich:suggestionbox id="mySuggestionBox" for="myText" reRender="mySuggestionBox" limitToList="true"/>
          </a4j:form>
          


          With this, the suggestion box does appear, and the post-construct method is only being called once, when the page loads. I'll do some more tests...

          Thanks!
          - Joseph