Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to map huge DB records to a JSP

Priya Arora
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic