1 Reply Latest reply on Jun 7, 2010 7:56 AM by Ilya Shaikovsky

    f:setPropertyActionListener + request bean + ajax

    m m Newbie

      I have ListBean (request bean) with navigation links (go to page... 1, 2, .....).

       

      When i click page on navigation i need to set page on bean and rerender list, but when i click page new instance of my request bean is created (request bean - it is normal), but changing page works only for <a4j:commandLink>s that was generated in first load page. Afret new request, new commandLinks doesn't call setPage on newly created bean. Why ??

       

      PS: I don't want to use a4j:keepAlive that make everything works.

       

      For example:

      first load page - navigation:

      1 2 3 4 ... 50

      after click 3: list reload and navigation looks like this:

      1 2 3 4 5 6 ... 50

      but clicking on 4,5,6 doesnt' work.

       

      public class PagedListBean {

        int page;

        public int getPage() { return this.page;}

        public setPage(int page) {this.page = page;}

        public List<Integer>getNaviPages() {

           ...

        }

        ...

      }

       

      <h:panelGroup id="list">

      <h:form>

        <!-- navigation -->

        <a4j:repeat var="page" value="#{listBean.naviPages}">

          <!-- dynamically created depending on actual page -->

          <a4j:commandLink value="#{page}" reRender="list">
                                                         <f:setPropertyActionListener target="#{listBean.page}" value="#{page}"/>
          </a4j:commandLink>

        </a4j:repeat>

         ...
      </h:form>

      </h:panelGroup>