I have created a jsp page with some credentials of the user and this time i dont want it to pass to the validation form servlet through doGet() but through doPost(). I am facing some problem while doing this validation of none of the field could be left blank.
PrintWriter out = response.getWriter();
String name= request.getParameter("name");
String address = request.getParameter("address");
String username= request.getParameter("username");
String password= request.getParameter("password");
if(name==null)
{
out.println("The name field cannot be left blank <br>");
}
else if(address==null)
{
out.println("The Address field cannot be left blank <br>");
}
else if(username==null)
{
out.println("The Username field cannot be left blank <br>");
}
else if(password==null)
{
out.println("The Password field cannot be left blank <br>");
}
else if(name!=null && address!=null && username !=null && password !=null)
{
out.println("Succesfully logged in");
}
When executed the jsp page gets redirected to the validationform servlet and am getting as output"Successfully logged in" even though i left some of the fields blank. I think request parameter is not concerned with doPost(). help me to find out the output