File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How to map huge DB records to a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to map huge DB records to a JSP" Watch "How to map huge DB records to a JSP" New topic

How to map huge DB records to a JSP

Priya Arora

Joined: Dec 08, 2003
Posts: 4
I have question on mapping DB records to a JSP using arraylist of actionform.
Currently I have situation in which I have to query database and display the obtained records on to the JSP. The number of DB records I get could vary from 20 to 20000.
So I am using array of value object to capture the obtained records and mapping them to array of actionform and putting this array of actionforms in session so that I can access this session object and display content on the JSP. To be more precise following is the overview of code
public ... Action(ActionForm form,...)
Arraylist afList=new ArrayList();
Arraylist volist = new ArrayList();
afList=mapVOtoAF(voList); //this map function will return the array of actionforms
This success action forward will take me to a JSP page where I will display content as
java.util.ArrayList aList = (java.util.ArrayList)session.getAttribute("ActionArray");
java.util.Iterator Itr = aList.listIterator();
//create an instance of actionform and display the content
So my question is am I doing the correct way or is there a better way to handling this situation. I have a concern with my code because if I get about 20000 records from DB I am afraid to put them in session because it might have performance impact.
Any suggestion or comments will be very helpful.
Thanks in advance.
I agree. Here's the link:
subject: How to map huge DB records to a JSP
It's not a secret anymore!