I have this servlet code for profile:
@WebServlet("/Profile")
public class Profile extends HttpServlet {
private static final long serialVersionUID = 1L;
public Profile() {
super();
// TODO Auto-generated constructor stub
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String conn = request.getParameter("connect") ;
String prenom = request.getParameter("Prenom") ;
String nom = request.getParameter("Nom") ;
if(conn!=null && prenom!=null && nom!=null) {
System.out.println("Profile line 45");
RequestDispatcher view = request.getRequestDispatcher("CheckCookie");
System.out.println("Profile line 47");
view.include(request, response) ;
System.out.println("Profile line 49");
System.out.println(request.getAttribute("cookieFound"));
if (request.getAttribute("cookieFound").equals(false)) {
System.out.println("Profile line 53");
RequestDispatcher pass = request.getRequestDispatcher("password.html") ;
System.out.println("Profile line 55");
pass.include(request, response) ;
*System.out.println("Profile line 57");*
System.out.println(request.getParameter("Password"));
if (request.getParameter("Password").equals("0000")) {
RequestDispatcher view2 =request.getRequestDispatcher("CookieTest");
System.out.println("Profile 61");
view2.include(request, response) ;
}
}
}
}
}
And this is the password.html from where I get the parameter
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Password 2</title>
</head>
<body>
<form action="Profile" method="post">
<label for="Nom">Nom :</label>
<input type="text" id="Nom" name="Nom">
<br>
<label for="Password">Password :</label>
<input type="text" id="Password" name="Password">
<br><br>
<input type="submit" value="Se connecter" name="connect">
</form>
</body>
</html>
I wrote some prints inside the servlet code to see when the problem happens and it stops at "Profile line 57" print the the password read from the parameter has null value even if i give value for password in the form generated by password.html.
I tried to get other parameters like request.getParameter("Nom") and it's working so the problem is just in retreiving "Password