You should give the displaytag:table a collection that contains "pageSize"
objects.
This collection should also implement PartialList.

You probably give the same collection each time, you collection having
10(resultSize) objects.

Here is a short example :

First you need to create a class that will be passed to the display:table
tag :

class ListaPaginata
    implements PaginatedList
{

    private final int itemsPerPage;
    private final int pageNo;
    private final String sortColumn;
    private final String sortDir;
    private final Map<String, Object> params;

    /**
     * Constructor
     * @param itemsPerPage - marimea paginii de afisat
     * @param pageNo - numarul paginii curente
     * @param sortColumn - coloana dupa care se sorteaza
     * @param sortDir - directia de sortare (asc / desc)
     * @param params - parametrii de filtrare a datelor
     */
    public ListaPaginata(int itemsPerPage, int pageNo, String sortColumn,
String sortDir, Map<String, Object> params)
    {
        this.itemsPerPage = itemsPerPage;
        this.pageNo = pageNo;
        this.sortColumn = sortColumn;
        this.sortDir = sortDir;
        this.params = params;
    }

    public int getFullListSize() {
        try {
            // get the size of your collection from the database or your
backend
            return getCount(params).intValue();
        } catch (SQLException e) {
        }
    }

    public List<SmciTabLog> getList() {
        try {
// get your objects (only the ones on the page requested - figure out a way
of doing that in your backend)
            return listAllPaginated(itemsPerPage, pageNo, sortColumn,
                sortDir, params);
        } catch (SQLException e) {
        }
    }

    public int getObjectsPerPage() {
        return this.itemsPerPage;
    }

    public int getPageNumber() {
        return this.pageNo + 1;
    }

    public String getSearchId() {
        return null;
    }

    public String getSortCriterion() {
        return sortColumn;
    }

    public SortOrderEnum getSortDirection() {
        if("asc".equals(sortDir)) {
            return SortOrderEnum.ASCENDING;
        } else if("desc".equals(sortDir)) {
            return SortOrderEnum.DESCENDING;
        }
        return null;
    }

}

In your servlet - initialize an object like this one and pass it to the
table tag.

Hope this gives you a quick start,

Cheers,
Narcis

2009/5/27 Kanchana S <[email protected]>

>  Hi,
>
> I am using Displaytag 1.1 ,Can anyone Give Example ,how to implement
> Partial List
>
> In Jsp code i have specified partialList="true" size="resultSize"
> (resultsize = 10 ) and pagesize="5"
>
> In Jsp It Displays 2 Pages Each with 5 records,but in Second page it
> displays the same 5 records as in first page
>
> how to get the remaing records?
>
> Can anyone give me the samplecode  to implement  Partial List
>
>
>
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals.
> Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
> _______________________________________________
> displaytag-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user

Reply via email to