• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pagination

 
veda vyas
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to pass pagesize value dynamically from jsp how can i do this ,below i am putting my java class


public IExtendedPaginatedList getPaginatedListFromRequest(HttpServletRequest request){

IExtendedPaginatedList paginatedList = new PaginatedListImpl();
String sortCriterion = request.getParameter(IExtendedPaginatedList.IRequestParameters.SORT);
paginatedList.setSortDirection(IExtendedPaginatedList.IRequestParameters.DESC.equals(request.getParameter(IExtendedPaginatedList.IRequestParameters.DIRECTION))? SortOrderEnum.DESCENDING : SortOrderEnum.ASCENDING);
paginatedList.setSortCriterion(sortCriterion);
int pageSize = 25; // Rows per page
paginatedList.setPageSize(pageSize);
String thePage = request.getParameter(IExtendedPaginatedList.IRequestParameters.PAGE);
if(thePage != null){
int index = paginatedList == null? 0 : Integer.parseInt(thePage) - 1;
paginatedList.setIndex(index);
}else{
paginatedList.setIndex(0);
}

return paginatedList;
}

please help me
 
Mohamed Sanaulla
Saloon Keeper
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags and also TellTheDetails - we need to know what is the problem with the code you have provided or what are the exceptions being thrown. You could have a look at PaginationOrPaging which explains some approaches for Pagination.
 
Paul Clapham
Sheriff
Posts: 20983
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Two things:

(1) Remove the line which hard-codes the number of lines per page.

(2) Pass the number of lines per page as a parameter of the method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic