This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to maintain session in Both Parent window and child window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to maintain session in Both Parent window and child window" Watch "How to maintain session in Both Parent window and child window" New topic
Author

How to maintain session in Both Parent window and child window

sumanta panda
Ranch Hand

Joined: Jun 23, 2008
Posts: 224
Dear Sir,
I am using session concept in application.

After login my application the Main screen screen is comming which we call parent window.
Under the parent window serverral child window are comming.

Suppose i click one child window under the that same parent window and when session time out.
if i do any operation in child window then session message comming and saying"Session time out".

It will close only child window.

My doubt is if session is time out if we also in clind it should aslo close parent window.But in my
case when session expire if you performed something if child window it also close parent window.

if you do some work in parent window and open clild window then clind window close at the session expire time.
Viceversa situation not working.

For example.:Login.jsp(Firstpage)Once we login then we goto home.jsp(Parent window)
Under the parentwindow serveral submenu is thier and child link also thier.

When we open submenu underHome.jsp do some work and same time onen child window and
session expire it will go to Login.jsp(Which is correct).

But if we open clild window and do some work and session expire it only close child window.
again we click parent window then it come to Login.jsp..

Could you please advise me on session expire The child window and parent should close automatically
if we perform anything in any window(Parent window and child window).


Please advise me for the neeedful.

Thanks in advance
Regards
Sumanta Panda
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Make use of Javascript´s setTimeout() function and the value from ${pageContext.session.maxInactiveInterval} which returns the remaining session lifetime in seconds.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

You cannot close a window you did not open. So if your parent window is not one that was opened with window.open() you cannot close it. Why would you want to? How rude would that be?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
jQuery in Action, 2nd edition
 
subject: How to maintain session in Both Parent window and child window