I am performing validation of inputted data such as email, password, name, etc. But I am already stuck on the first stage of validation which is to check if User entered nothing.
I already added enctype="multipart/form-data"
as mentioned here but now it is always recognizing email
as null
and I can't forward to the login page in case of success (when email is not null).
Code
signup.jsp
<form method="POST" action="signup" enctype="multipart/form-data">
<input type="email" name="email" placeholder="tonystark@mail.com">
<input type="submit" value="Submit">
</form>
SignUpAction.java
public class SignUpAction implements Action {
@Override
public String handleRequest(HttpServletRequest req, HttpServletResponse resp, DAOFactory dao)
throws ServletException, IOException {
String email = req.getParameter("email");
if (email == null || email.isEmpty()) {
return "signup"; // It loads signup page again (it works)
}
return "login"; // It should go to the login page (it doesn't work)
}
}