Pagination query

From: Sami Mohammed (SMOHAMME..ndependenthealth.com)
Date: Thu Feb 10 2005 - 14:02:07 EST

  • Next message: Laszlo Spoor: "Re: [question] Tomcat 5.5 & JNDI DataSources -> [solution]"

    Hi
    >
    > Thanks once again for your help.
    > I have one proble that i have to do paginate in my
    > webapplication. i have 2000 rows and i have to show 20
    > rows on each page. could you send me the detail
    > example of paginate with classes and jsp pages.
    > i have your example below but that is not sufficant
    > for me
    >
    > your tutorial example below:
    > ---------------------
    > import java.util.List;
    > import java.util.Map;
    > import org.objectstyle.cayenne.access.DataContext;
    > import org.objectstyle.cayenne.query.SelectQuery;
    > import org.objectstyle.art.Artist;
    > ...
    > DataContext ctxt;
    >
    > // create a query returning data rows
    > SelectQuery q = new SelectQuery(Artist.class);
    > q.setPageSize(50);
    >
    > // the fact that result is paged is transparent
    > List artistRows = ctxt.performQuery(q);
    >
    >
    > // we are reading from the first page (index < 50),
    > // this will simply return an object
    > Artist artist1 = (Artist)artistRows.get(3);
    >
    > // we are reading from the 4th page,
    > // this will transparently resolve all objects on
    > "Page #4"
    > // and then return an object in question
    > Artist artist2 = (Artist)artistRows.get(153);
    >
    >
    > // This is safe and will NOT trigger a full fetch
    > int size = artistRows.size();
    > ...
    > --------------------
    > send me the jsp page where i can display 20 rows and
    > next and previous page.
    i need some sample example

    >
    > thanks
    > sami



    This archive was generated by hypermail 2.0.0 : Thu Feb 10 2005 - 14:02:31 EST