0

I am a newbie in display tag. I am using display tag 1.2,struts2 and hibernate. Display tags works great, except its fetching entire db row whenever i clicked on next page. I find out that I have to use external pagination of display tag. As I am a newbie, So any complete example of external pagination would be appropriated.

arvin_codeHunk
  • 2,328
  • 8
  • 32
  • 47

2 Answers2

0

i have some problem with paginatedList

This is my previous hibernate method to show list on page

public List<TXT_Beans> regenerateListData(int cust_Id)
{
   Session session = HibernateUtil.getSessionFactory().getCurrentSession();
   String sqlQuery=null;
   List<TXT_Beans> txtList = new ArrayList<TXT_Beans>();

  try  
  {
   sqlQuery="select `accounts`.`account_id`,`customer_information`.`customer_unique_enroll_id`,`accounts`.`branch_id`,csp_information`.`bc_csp_code`,`csp_information`.`csp_alpha_id`,`customer_information`.`first_name`,from `customer_information` join `customer_accounts_xref` using (customer_unique_enroll_id) WHERE`customer_accounts_xref`.`customer_unique_enroll_id`="+cust_Id;
     session.beginTransaction();

............................ This was my previous query when display tag was fetching the entire row. Now How to modify this for the situation where I have to fetch only specified no. of row instead the entire db using display tag ,no need to sort.

arvin_codeHunk
  • 2,328
  • 8
  • 32
  • 47
  • actually my problem is : 1) There is a txt file which has n no. of customers. so i have to iterate all customers one by one and based on customersId as a parameter i have to call above hibernate method to fetch all details of respective customers. So problem is that how to provide external paging because i have to provide customerId to fetch details...any help would be appropriated. – arvin_codeHunk Oct 16 '12 at 12:52
0

External paging is 4 step process.

  1. Get the total result count, divide by page size and display the page numbers in UI.
  2. Make the database call with pageNumber to retrieve the data along with the filter conditions if any from server component e.g your hibernate
  3. In your server side code, you have to retrieve record starting from pagesize * pagenumber +1 to pagesize * (pagenumber+1) and return back. This is referred as paged result.
  4. Display the paged result return from step 3 in the UI with pagenumber selected.
Yogendra Singh
  • 33,927
  • 6
  • 63
  • 73