0

I have to make a login form for a java project using servlets, MySql and jsp. Everything works fine except that when the username or the password are incorrect the login page should display an error message. I think it' a very simple task but somehow I can't do it, can anybody help me? This is the code in the servlet, and I think it's correct:

if (user != null) {
                HttpSession session = request.getSession();
                session.setAttribute("user", user);
                response.sendRedirect("loginsuccess.jsp");
            } else {
                request.setAttribute("error", "Attenzione! username o password errati.");
                response.sendRedirect("login.jsp");
            }

Now I have to create an alert in the login.jsp page displaying this error, what should I do?

Roman C
  • 49,761
  • 33
  • 66
  • 176
  • 1
    Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 30 '22 at 09:03

0 Answers0