Re: How to catch the Session Time Out event ??

2001-08-29 Thread Jonathan M Crater

this type of processing is better placed in the controller.  i would suggest
either subclassing ActionServlet or providing a generic base class for each of
your Action classes which performs a check similar to:

HttpSession session = request.getSession();

if(session == null) {
  mapping.findForward(welcome);
}

this way the logic is in one place and always checked on each request.

Xavier Brunel wrote:

 Hi all,

 I am using Struts for an Intranet application (Linux,Sybase,Java) and it is
 working very well.
 The last thing I would like to do is forwarding automatically the current
 client to the welcome page when his session is timeout, through a call to a
 particular ActionForward of struts-config.xml

 I built a JSP page (index.jsp) who calls the correct forward :
 
 %@ page language=java %
 %@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
 logic:forward name=welcome/
 
 I have the correct struts-config.xml structure (when i call the jsp directly
 i actually go to the welcome page who is a template).
 -
 global-forwards
 forward name=welcome  path=/jsp/t-welcome.jsp/
 /global-forwards
 -

 But I have one last problem :
 I would like to know how to catch the session time out event, in order to
 call the index.jsp page.
 As anybody an idea about this ???

 Xavier





RE: How to catch the Session Time Out event ??

2001-08-29 Thread Roumen Ganeff

In order to see if the client has a valid session, you will need to save
some data in the session, and in the beginning of each page check for this
data, for example the session key, or the user name. If the check returns
null then there is no session, and the user has to start over. We usually
do a custom tag checksession which we call in our template.jsp, used by
struts. This way you won't have to copy/paste in all pages

Ganeff

-Original Message-
From: Xavier Brunel [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 29, 2001 3:29 PM
To: 'Struts-User
Subject: How to catch the Session Time Out event ??


Hi all,

I am using Struts for an Intranet application (Linux,Sybase,Java) and it is
working very well.
The last thing I would like to do is forwarding automatically the current
client to the welcome page when his session is timeout, through a call to a
particular ActionForward of struts-config.xml

I built a JSP page (index.jsp) who calls the correct forward :

%@ page language=java %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
logic:forward name=welcome/

I have the correct struts-config.xml structure (when i call the jsp directly
i actually go to the welcome page who is a template).
-
global-forwards
forward name=welcome  path=/jsp/t-welcome.jsp/
/global-forwards
-

But I have one last problem :
I would like to know how to catch the session time out event, in order to
call the index.jsp page.
As anybody an idea about this ???

Xavier





Re: How to catch the Session Time Out event ??

2001-08-29 Thread SUPRIYA MISRA

I have an idea. Run a thread  which continously checks currentTime - 
session.getLastAccessedTime(). If that is greatetr than 15 minutes
this thread forwards to the index page.



From: Xavier Brunel [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: 'Struts-User [EMAIL PROTECTED]
Subject: How to catch the Session Time Out event ??
Date: Wed, 29 Aug 2001 14:29:23 +0200

Hi all,

I am using Struts for an Intranet application (Linux,Sybase,Java) and it is
working very well.
The last thing I would like to do is forwarding automatically the current
client to the welcome page when his session is timeout, through a call to a
particular ActionForward of struts-config.xml

I built a JSP page (index.jsp) who calls the correct forward :

%@ page language=java %
%@ taglib uri=/WEB-INF/struts-logic.tld prefix=logic %
logic:forward name=welcome/

I have the correct struts-config.xml structure (when i call the jsp 
directly
i actually go to the welcome page who is a template).
-
global-forwards
 forward name=welcome  path=/jsp/t-welcome.jsp/
/global-forwards
-

But I have one last problem :
I would like to know how to catch the session time out event, in order to
call the index.jsp page.
As anybody an idea about this ???

Xavier



_
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp