I made a simple website with login page, everything works fine except when user click on GO BACK button in browser, the previous page shows up after logout.
I have tried to track session, but not successful, any suggestions? ps: i prefer to achieve this on server side programming.
Thanks
Here is my redirect url filter, if anything, this could be where the problem is
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
throws IOException, ServletException
{
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
HttpSession session= request.getSession(false);
if(request.getRequestURI().compareToIgnoreCase("/login.jsp")!=0&&
request.getRequestURI().compareToIgnoreCase("/")!=0)
{
if (session!=null &&!session.isNew())
{
chain.doFilter(req, res);
}
else
{
response.sendRedirect(request.getContextPath()+"/login.jsp");
}
}
else
{
chain.doFilter(req, res);
}
}