At the beginning of each page you can do this:
String username = (String)session.getAttribute("USER");
if(username==null) { // session expired
// FORWARD WITH ANY WAY YOU WANT
if(username==null) { // session expired
// FORWARD WITH ANY WAY YOU WANT
// I usually use the Request Dispatcher class.
RequestDispatcher rd = context.getRequestDispatcher("/demo/inner.jsp");
rd.forward(request,response);
}
RequestDispatcher rd = context.getRequestDispatcher("/demo/inner.jsp");
rd.forward(request,response);
}
No comments:
Post a Comment