Value list handler question

Discussions

EJB programming & troubleshooting: Value list handler question

  1. Value list handler question (1 messages)

    Hi,
    i'm using the value list handler pattern, but i still have one doubt.
    I show the results on the jsp 10 by 10, and also show a field like

    "8000 results found"

    The collection that i return to the jsp is full of DTOs (suppose, a list of companies, for this case the collection will be filled with companyDTOs). As the collection that is returned to the jsp has always a size of 10 (as i said, i return the results in 10 elements a time) i need to make 2 remote calls to my session bean to get the total numbers of results and the 10 next restults themselves.

    Somthing like this. After the user press "Search".

    In a servlet:

    // call EJB to get the list of results.
    // set variable in request (or session) scope

    // call EJB to get the list of the first 10 results
    // set collection in request (or session) scope


    As you can see i don't know how to get the total number of found elements (wich is 8000 for the example) and a list of my first N elements in the same remote call. I cannot set the number of total results in the collection that keep the DTOs, would'n be good.

    How can i avoid this 2 remote calls???
  2. Value list handler question[ Go to top ]

    How can i avoid this 2 remote calls???
    I generally create a second object that holds both the total results along with the first page of results.

    i.e. make one remote call but return

    public class CompanyPageDTO
    {
        private CompanyDTO[] first10;
        private int total;
        ....
        get/set methods
    }

    Hope this helps

    Ian Purton
    Website and Server Monitoring | Email Marketing | Website Traffic Analysis | Top 100 Album Charts