@Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { if (request.getParameter("logout") != null) { request.getSession().invalidate(); response.sendRedirect("/books"); return; } request.setAttribute("books", BookStore.getBooks()); RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/public/books.jsp"); dispatcher.forward(request, response); }