aspose file tools*
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
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
Author

How to map huge DB records to a JSP

Priya Arora
Greenhorn

Joined: Dec 08, 2003
Posts: 4
Hi,
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();
voList=getDBrecords();
afList=mapVOtoAF(voList); //this map function will return the array of actionforms
session.setAttribute("ActionArray",afList);
action.forward("success");
}
------------------------------------------------------------------------
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();
while(Itr.hasNext())
{
//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.
Priya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to map huge DB records to a JSP
 
Similar Threads
how do you display the struts forward to jsp
struts validation repopulate arrays, arraylists
Advice on persisting complex state across multiple server trips
Displaying ResultSets in View
Checking the size of an ArrayList in a JSP page