File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes how to pass session to different web pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to pass session to different web pages" Watch "how to pass session to different web pages" New topic
Author

how to pass session to different web pages

Hideki Mae
Greenhorn

Joined: Oct 19, 2004
Posts: 14
To all:
Is there a way to pass session from one web application to another web application? For example, I have a web app (context root is /dwm), and in this application I do "session.setAttribute("tablist", tablist);" The variable tablist is an array containing names of a tab button which takes me to a different web app (context root is /rehabweb). In /rehabweb I would like to generate the tab buttons again by doing: "tablist = session.getAttribute("tablist");" so I don't have to go to the database to get it again. When I check my debugger the session variables from /dwm are gone once I reach /rehabweb.
Can you pass session id as an query parameter and retrieve the original session somehow? I'm not sure how you would do this.

Thank you for any help you can give me.
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

Hideki,
Web applications cannot share sessions. Different web pages within the same web application can though.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Ankush Bhargava
Greenhorn

Joined: Dec 03, 2004
Posts: 19
well try serialising your httpsession object. add it to the database.
and then deserialise the same object in the ohter application!
that should work for you
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29249
    
139

Ankush has a good point about serializing data. However, it is better to store just the needed data than the whole session.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
session serialisation might look a nice idea but you're in for big trouble as session ids will get messed up royally in the application that does the deserialisation


42
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to pass session to different web pages
 
Similar Threads
Context root inWeblogic
Document Root vs Context Root
forwarding to a different webApp
import javax.servlet,import org.apache can not be resolved
Session lost due to....?