HTTP Status 405 - HTTP method GET is not supported by this URL I m getting this error when i m clicking on logout button here is the code for it.............
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class LogoutServlet extends HttpServlet{
public void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
HttpSession session = req.getSession();
session.invalidate();
//getServletContext().getRequestDispatcher("/index.jsp");
res.sendRedirect("/FirstProject/index.jsp");
}
public void doGet(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
doPost(req,res);
}
}
I have tried but can't get it ......is there is some problem with code ,
thanks
Sam