This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Storing arraylist of hashmaps in session

 
Abhijit Sontakey
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Naveen K Garg
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 67
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Either read it twice (once to show it and once to generate your Excel sheet) from the database, or store it in session.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic