2 Replies Latest reply on Aug 23, 2006 10:43 AM by sjmenden

    best practices with pages.xml

    sjmenden

      I need advice on best practices. Here is what I want to accomplish. I am trying to implement a page that shows all registered users, that also has pagination. Well, when the user clicks on the showUsers.jsf link, the List of users should be initially populated.

      Here is what I'm doing now and the problem I'm having. I definted an action in pages.xml so when the showUsers.jsp is accessed, the bean's firstPage method is accessed like in one of the seam examples.

      PROBLEM: When I click the nextPage action for pagination, the nextPage gets invoked THEN the firstPage because the pages.xml kicks in.


      So how do I resolve this problem of the pages.xml getting invoked everytime I click any action on the showUsers page? Is there a better method to do what I want?

      Thanks.

        • 1. Re: best practices with pages.xml
          mzeijen

          Couldn't you better use a @Factory method? The method initializes your user list on Component creation. If you use it together with the @DataModel annotation then the list will be automaticly filt.

          In the @Factory method you could also implement the pagination.

          • 2. Re: best practices with pages.xml
            sjmenden

            Thank you for the response, so I should be able to use pull-style MVC like in the Blog example. However, in that example, the BlogService is Stateless, hopefully employing it as Stateful will be with minimal pain. However, in the BlogService, there is no @Factory used, just the @Unwrap.

            Which method would you recommend?