Hello Vijay, Hope your business rules need to set session time out for each bean i.e, Bean based. But the "Session time out" we're speaking is application based. So as per m understandin you cannot do this.
Best Regards<br />N.Shankar<br />SCJP, SCWCD
Joined: Feb 13, 2004
Is there any other work around for this kind of situation???
Looks like you will need to use a Thread that wakes up after a certain no of seconds/minutes and checks if the bean has been accessed and takes the required action.
So, you can have a variable in the bean that records the time it is accessed, and when the thread wakes up it checks the value of that variable, if the difference from the current time is more than the 'timeout' value, it resets it.
But you might want to see if there is another way of enforcing that business requirements using some built-in session/request/application feature. Creating your own threads can get messy if you are not totally comfortable with multi-threading concepts, and if you do decide to use it, you will need to decide whether to run that a thread for the app or each session or each bean etc..
The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny GillTweets
I have a theoritical solution. You can add a HttpSessionAttributeListener and in the "attributeAdded" method, check the name of the attribute added(In your case probably each bean) and when added put this time in session as a variable.
In each JSP of your page or in super class of that JSP (if you have one) include a small jsp file (include file) which checks for the time differences from the time each bean inserted in the session to the present request time(System.getTimeInMillis() I guess) and based on that you can do what ever you want.