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.
Asked
Active
Viewed 3,789 times
0
-
for example, If my pagesize 15 rows per page but display tag fetch all the rows from database. every time when i click on pagination number,it fetch all of the rows from db. – arvin_codeHunk Oct 15 '12 at 07:53
-
Duplicated of http://stackoverflow.com/questions/3888367/display-tag-pagination-problem . The solution is there. – Andrea Ligios Oct 15 '12 at 10:18
-
okay Swift...but does this solution work? – arvin_codeHunk Oct 15 '12 at 11:24
-
Not sure, but a good way to know it is to try... – Andrea Ligios Oct 15 '12 at 12:19
2 Answers
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.
- Get the
total result count
, divide by page size and display the page numbers in UI. - Make the database call with
pageNumber
to retrieve the data along with the filter conditions if any from server component e.g your hibernate - In your server side code, you have to retrieve record starting from
pagesize * pagenumber +1
topagesize * (pagenumber+1)
and return back. This is referred as paged result. - Display the
paged result
return from step 3 in the UI withpagenumber
selected.

Yogendra Singh
- 33,927
- 6
- 63
- 73