Auto Close

Hey Im just wondering if you guys know of any timer like thing to close out or forward the page somewhere else? Im having problems with the session timing out and my page throwing errors because the session expired. So i figure Ill just log them out automatically when there is a session expiration..

[307 byte] By [jbayugaa] at [2007-11-26 18:09:56]
# 1
I use the <session-timeout> in web.xml and implement/register a normal SessionListener. When the session times out, the listener can do your "forward" or anything you like.
UlrichCecha at 2007-7-9 5:42:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Sorry Im new .. i have no idea what you mean.. it sounds exactly what im looking for though.. How do you implement a session Listener? In the bean?
jbayugaa at 2007-7-9 5:42:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

No problem:

first, put this code in your web.xml:

<web-app ...>

...

<session-config>

<session-timeout>30</session-timeout>

</session-config>

....

<listener>

<display-name>SessionListener</display-name>

<filter-class>...full qualified class name...</filter-class>

</listener>

...

</web-app>

The filter class has to implement the javax.servlet.http.HttpSessionListener. You can then code your "forward"-action or anything else in the method:

public void sessionDestroyed(HttpSessionEvent event) {

...

}

UlrichCecha at 2007-7-9 5:42:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

Hey man .. Sorry i think im retarded.. so in my web.xml i put

<listener>

<display-name>SessionListener</display-name>

<listener-class>../webadmin.conrtollers.Logout</listener-class>

</listener>

There doesn't seem to be a <filter-class> tag? and I called my class that implements the javax.servlet.http.HttpSessionListener "Logout" whats going on? I can't get the path right? or anything? Can you please please help :P THANKS

jbayugaa at 2007-7-9 5:42:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
Ups, "listener-class" is correct.you have to fill in the full qualified Java class name:...<listener-class> com.xyz.abc.SessionListener</listener-class>...Then the expected methods are called from this listener class.
UlrichCecha at 2007-7-9 5:42:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
Rather put the session in a cookie. Use a Filter.
BalusCa at 2007-7-9 5:42:02 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...