File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

paging

 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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.

Why is this due to?
 
David Ulicny
Ranch Hand
Posts: 724
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any exception?
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shan,
There aren't any inherent size restrictions. You are probably getting the 500 error due to a timeout.

1200 records isn't that many though. Do you know how long it goes before timing out?
 
Anonymous
Ranch Hand
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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

map.put(10,vector)
map.put(20,vector)


Now I would like to do paging. How Do I go about?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 33700
316
Eclipse IDE Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shan,
That's the standard case. You just want to page within a resultset. That resultset happens to reside in your map.

I would suggest doing a search of this and the JSP forums for "paging" to get ideas.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shan i am thinking in another way.

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
Posts: 18944
  • 0
  • send pies
  • Quote
  • Report post to moderator
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);
}

<TD align="center"><%=domain.empname%></TD>
<TD align="center"><%=domain.empdate%></TD>

}
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic