GeeCON Prague 2014*
The moose likes Servlets and the fly likes Storing arraylist of hashmaps in session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Storing arraylist of hashmaps in session" Watch "Storing arraylist of hashmaps in session" New topic
Author

Storing arraylist of hashmaps in session

Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
Hi,
I have a requirement of passing a large data such as an arraylist containing hashmaps. I have to pass this data from a jsp to the servlet.
One approach for doing this is to store the data in session as an attribute or pass as a request parameter. However i don't want to store this data in the session. Can anybody suggest an alternative approach. Any help will be appreciated.

Regards
Abhijit
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

I have to pass this data from a jsp to the servlet.

This is usually the other way around

However i don't want to store this data in the session

Could you tell us why ?


[My Blog]
All roads lead to JavaRanch
Naveen K Garg
Ranch Hand

Joined: Nov 28, 2005
Posts: 105
Hi Abhijit,

You can not pass an arraylist of hashmap as request parameter. The only option left to you is either store it in Session or in Request.

But as Satou rightly pointed out we need to understand your exact requirement in order to suggest something.

So if you can post your scenario that would be well and good.

Regards
Naveen
Abhijit Sontakey
Ranch Hand

Joined: Sep 26, 2005
Posts: 67
Hi,
My exact requirement is as follows:
1) I retrieve data from a database and use it for reporting.
After getting the data from database, i need to store it as HashMaps in Arraylist to do processing (data in database is not exactly as i want, hence i need to format).
2) Once i get the data i generate a report in jsp. There is a button in the jsp that downloads the report in excel which is done by a servlet. I need to pass the formatted data that is in form of arraylist from my servlet to another servlet.

I hope the requirement is clear now.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Either read it twice (once to show it and once to generate your Excel sheet) from the database, or store it in session.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
GeeCON Prague 2014
 
subject: Storing arraylist of hashmaps in session