so all my data stored in session will expire after 15min, I have stored userId and userName in session but the problem is-
I am not able to understand from clentside whether my session data are still available or not, so when i hit any button or links, I got exception because I don't have my userId is session (userId is needed),
How can i solve this, so that after session is expired, user is redirected to login page automatically or after hitting any links or buttons on the page.
Check the session inside your filter or servlet(central controller) first, if the session is new and the request for a resource that is not accessible without login, send the login-page to the user or else send him the resource.
I think interceptor pattern is useful when your application requires logging or checking of the request, In your scenario your want to check for the session, so it might be the servlet or filter who is invoked first, check in this servlet whether the session has user_id or not and forward to the corresponding pages.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com