File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing HashMap object from one jsp to another

 
pratapsiva sivakumar
Greenhorn
Posts: 18
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir,
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
Posts: 874
Android Java VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Pratap,

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
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you want that hashtable to multible pages, then add it to session object

session.setAttribute("hashSesObject",hashTableObj);

second page you can get the object by using.

HashTable hashTableObj = (HashTable)session.getAttribute("hashSesObject")
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

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.

Sean
 
Ketan Parikh
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic