am using servlets to make a website of mine and having issues in releasing the session, pls check and find the error out:
login.java :
ResultSet res=smt.executeQuery("Select * from admin where name='"+user+"' and password='"+password+"'");
while(res.next())
{
String name=res.getString("name");
String pwd=res.getString("password");
if(category.equals("Admin"))
{
if(name.equals(user) && pwd.equals(password))
{
ServletContext context=request.getServletContext();
context.setAttribute("name", name);
HttpSession session=request.getSession();
session.setAttribute("name", name);
RequestDispatcher view=request.getRequestDispatcher("welcome_admin.jsp");
view.forward(request, response);
}
else
{
response.sendRedirect("index.jsp");
}
}
and the logout.jsp is :
<body>
<%
session.removeAttribute("name");
session.invalidate();
%>
<b>
<%
RequestDispatcher rd=request.getRequestDispatcher("index.jsp");
rd.include(request, response);
%>
</b >
</body>
but the session isn't released and if i click the back button it again redirects me to pages!! someone pls help me out!!