java - How to redirect on login page after logout -
i want when click on log out tab redirect on login page after logout. not go on login page.
home.jsp
<ul><li><a href="http://pushkalit.in/logout.jsp"> logout</a></li></ul>
logout.jsp
<% try { if(session.getattribute("username") != null) { response.setheader("cache-control","no-cache"); response.setheader("cache-control","no-store"); response.setheader("pragma","no-cache"); response.setdateheader ("expires", 0); session.invalidate(); response.sendredirect("http://pushkalit.in/hrlogin.jsp"); } else {} } catch(exception ex) { out.print(ex); } %>
url mapping in anchor tag seems wrong.
it linked logout.jsp
have redirect code in hrlogout.jsp
.
change:
<a href="http://pushkalit.in/logout.jsp"> logout</a>
to:
<a href="http://pushkalit.in/hrlogout.jsp"> logout</a>
Comments
Post a Comment