-
if statement
why isn't the if statement working. It goes else part even if the username and password is in there.
String vusername = request.getParameter("username");
String vpassword = request.getParameter("password");
if((vusername != null) && (vusername.equals(""))) {
response.sendRedirect("http://localhost:8080/myHW3/CatalogServlet");
} else {
out.println("<html>");
out.println("<head>");
out.println("<title>Login</title>");
out.println("</head>");
out.println("<BODY BGCOLOR=357EC7>");
out.println("<form method=POST>");
out.println("Invalid username/password");
out.println("<p><A style=color:black HREF=RegistrationServlet>Click here to return to Login Page</A></p>");
out.println("</form>");
out.println("</BODY></HTML>");
-
I think u want to say when !vusername.equals("")
instead, which would mean you are checking for
when user is not null and user is not empty
-
For what purpose you are using - vusername.equals((""))??
Try if block without using vusername.equals((""))
-
it was actually a syntax error in the HTML...thanks!
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
|
Bookmarks