File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes how to find session btn two web appl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to find session btn two web appl" Watch "how to find session btn two web appl" New topic

how to find session btn two web appl

sammeta Phanikumar
Ranch Hand

Joined: Oct 25, 2007
Posts: 81
Hi Ranchers,

Would you please help me how to identify session between two web applicaitons. When a user clicks link to second application from first. I want to close his sesion on first appl and want to maintian count of live sessions on first application.

I have tried with HttpSession and HttpActivationSession but no use.

Please help me.

Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

session can not be shared between two different web application
sammeta Phanikumar
Ranch Hand

Joined: Oct 25, 2007
Posts: 81
Thanks For your reply,

Session can not be shared. ok..but want first appl to be notified when a session leaves his appl.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63868

Please use real words when posting to the forums. Abbreviations such as "btn" in place of "between" only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

JavaRanch sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33130

You can know when they logout or a session timeouts. If they are going to another app you control, you can include a hidden iframe with a logout link back to the first application.

However, you wouldn't always know when they left as they could go to a different website or close the browser. The only way to know for sure is with constant pinging which is a drain on resources.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Steve Luke

Joined: Jan 28, 2003
Posts: 4181

Hi sammeta, I wanted to respond to your P.M. about this topic.

The only thing that I really can say is to agree with Jeanne. If you are following a link to an application you control then you can provide an IFrame that goes back to the first app and logs the user out. A similar alternative would be to make any links to the second application a link to a logout page in application 1 that then redirects to a page in application 2. This way you can keep the session control in a single app (you could pass the URL to application2's page as a parameter to the logout page).

As Jeanne said, you still can't tell if the user goes to some other website, or closes their browser. In addition to those limitations, the one I proposed also wouldn't work if the user makes bookmarks for the application2 page, or manually enters the application2 page's URL into the address bar.

<p.s. sammeta, I am happy to help, and don't mind the P.M.s asking me to take a look at a particular thread. But as an FYI I will always respond in the thread itself, since it will help the JavaRanch community as a whole>

I agree. Here's the link:
subject: how to find session btn two web appl
It's not a secret anymore!