I have a select statement that retrieves 1200 records and some times 10 records.. I use a vector to store the row information. When the select st returrns 1200 records the I get 500 error. where as if its less than that maybe 40 -50 reords it works fine.
I get 500 error and stops at rs.next() statement. Is there something like a database can retrieve only "X" number of rows or a webpage cannot have more than particular number of rows.
This morning surprisingly everything seems to be fine. It allows me to fetch upto 3400 records.
Now I have a question. I have all these records in a Treemap . all the records are stored as object's in the treemap. The way data is stored in treemap is
Shan, What does the "10" and "20" mean? Is that the position number?
I would suggest storing the data in a List structure, like an ArrayList, to facilitate paging. Then you can use indexes to get the sublist you want to display on a given page.
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
map.put(10,Vector)
means for Deptno 10 I store all the employee information in Vector.
In my report the user is allowed to select 5 deptno. I have to display the employee information of each dept.
My report looks like
Dno 10 Dept Name HR Eno Ename 1 JOhn 2 Adam 3 Mike
Dno 20 Dept Name PAYROLL Eno Ename 7 Jim 8 Tom 9 Mary
Shan, Your scenario is a bit more complex that the standard paging question. And now I see why you are using a map.
When you do the paging, do you want to display a certain number of dept numbers or a certain number of rows on the page? For the former, you can use the standard paging solutions on a list of sorted keys. Then display each record in that section. For the later, you will need a counter of your own.
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I would have deptno listed on top of my page like
10 20 30 40 50
By default it opens with the records of first deptno here 10.
If the records exceed 100 then in that page I need paging. [ October 22, 2004: Message edited by: shan javan ]
you said that it is working fine now and fetching upto 3400 records. and then you mentioned that you need to sort the records accoring to departments, because you are manipulating records according to the department on your front-end UI. So, why not manipulate the records according to the departments at the back-end as well.
I think you should query just the records of the requested department and then use standard paging. it will save you in the future when there would be 100,000's of record.
what you people say?
Anonymous
Ranch Hand
Joined: Nov 22, 2008
Posts: 18944
posted
0
I now have vector of records for each deptno. I want place first next prev and last button on same page. I have no idea where to start. I saw couple of posts on paging but that didn't trigger any ideas. Can some help me with this?
BElow is the code I use to just display all the records.
Dept.jsp
First Next Prev Last ...need here
Vector v = (Vector) request.getAttribute("EMPLIST"); out.println("list size = " + v.size()); for (int i = 0; i < v.size(); i++) { Dept_Domain domain = new Dept_Domain(); domain = (Dept_Domain) v.elementAt(i); }