File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Passing HashMap object from one jsp to another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Passing HashMap object from one jsp to another" Watch "Passing HashMap object from one jsp to another" New topic

Passing HashMap object from one jsp to another

pratapsiva sivakumar

Joined: Nov 10, 2008
Posts: 18
I have created a HashMap object in one jsp page.i want to pass the HashMap Object to another jsp page.How to do it with an example please?
Balu Sadhasivam
Ranch Hand

Joined: Jan 01, 2009
Posts: 874


If both jsp belong to same request , use JSTL <c:set> to set in "request scope" and forward to the other jsp. If its part of next request , then store it in "session scope".
samuel soundra rajan

Joined: Sep 25, 2009
Posts: 5
if you want that hashtable to multible pages, then add it to session object


second page you can get the object by using.

HashTable hashTableObj = (HashTable)session.getAttribute("hashSesObject")

(Java Programmer)

Sean Clark

Joined: Jul 15, 2009
Posts: 377


you can use the <c:set> tag to set it in session scope as well.
Try to avoid using java scriptlets as shown above inside your JSPs as it can make them quite unreadable.


I love this place!
Ketan Parikh

Joined: May 24, 2006
Posts: 6
I think from above posts you must have got your answer.

I want to include one more thing which may be helpful to you. If you are not updating your hashMap on different jsps, it is good idea to set read only hashMap in Session Or Request Object.

Ketan Parikh
I agree. Here's the link:
subject: Passing HashMap object from one jsp to another
It's not a secret anymore!