
hello Sir, I have to make a web application in which i have to give session timeout .
means if screen is inactive for a particular period of time then automatically it should
redirect to login page from where user has to login again to access the resources.
I know filters are used for this but do not have the idea .
will you plz give me the example for this task .
will always be gratefull.
Thank you Sir. View Answers

Here is a code. Check it.
HttpSession session = request.getSession(false);
// don't create if it doesn't exist
if(session != null && !session.isNew()) {
chain.doFilter(request, response);
} else {
response.sendRedirect("/login.jsp");
}
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.