• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to map huge DB records to a JSP

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic