• Post Reply Bookmark Topic Watch Topic
  • New Topic

Catch Session Timeout with Bean

 
Winston Smith
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I'm trying to use a Bean called SessionListener, which implements HttpSessionBindingListener. I can catch binding and unbinding events, however, I'm not sure how these work in the context of a bean. If I understand session correctly, everytime you refresh a page, it does not create a new session, yet my bean continually calls the valueBound function to indicate binding to a session. I'm using the <jsp:useBean ...> tag to
include my bean in every page. If anyone can explain the use of the
HttpSessionBindingListener, I'd greatly appreciate it.
Thanks!
WS
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are on the right track.
You just need to give the bean "session" scope in the useBean tag. The default scope is "page" - causing a new bean to be created and bound with every page as you are seeing.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!