public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
String login = req.getParameter("login");
String password = req.getParameter("password");
String logged = check(connection, login, password);
System.out.println("check Login logged: " + logged);
System.out.println("check Login login, password: " + login + " " + password);
if (logged != null) {
HttpSession session = req.getSession(true);
session.setAttribute("login", logged);
res.sendRedirect("ProductList");
} else {
...
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
PrintWriter toClient = res.getWriter();
String categoryId = req.getParameter("id");
HttpSession session = req.getSession(false);
String login = null;
if (session != null) {
login = (String)session.getAttribute("login");
System.out.println("ProductList logged");
System.out.println("ProductList login: " + login);
}
toClient.println(Utils.header("Products", login));
...
public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
res.setContentType("text/html");
HttpSession session = req.getSession(false);
if (session != null) {
session.invalidate();
res.sendRedirect("CheckLogin");
}
}
In folder northbrickSession