jsp - User not logged out after invalidating session -
give me suggestion instead of using scriptlets in jsp
i clicked on logout works , says logout without inserting username , password when clicked on sign in, automatically login how solve this?
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="css/style.css"> <title>logout page</title> </head> <body bgcolor ="#61b3de"> <% session.removeattribute("userid"); session.removeattribute("password"); session.invalidate(); %> <center> <h1>you have logged out</h1> login again <a href="login.jsp">click here</a>. </center> </body> </html>
by looking @ code provided link can check if have both user name , password in session or not. if not find them in session take user error page.
something this.
if(session.getattribite("userid") == null || session.getattribite("password")==null){ response.sendredirect("error.jsp"); }
this solve problem.
Comments
Post a Comment