Why is if executed if the value is null?
System out Result = null
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session = request.getSession(false);
String wrong = "Falscher Benutzer oder Passwort";
if (session != null) {
String user = (String) session.getAttribute("user");
session.setAttribute("user", user);
RequestDispatcher rs = request.getRequestDispatcher("start.jsp");
rs.forward(request, response);
System.out.println(user);
} else {
request.setAttribute("Fehler", wrong);
RequestDispatcher rs = request.getRequestDispatcher("login.jsp");
rs.forward(request, response);
}
Thank you
Aucun commentaire:
Enregistrer un commentaire