Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>Login</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  6. </head>
  7. <body>
  8. <div>
  9. <form method="POST" action="validate.jsp">
  10. User: <input type="text" name="typed_username"><br><br>
  11. Password: <input type="password" name="typed_password" ><br><br>
  12. <button type="submit">Login</button>
  13. </form>
  14. </div>
  15. </body>
  16. </html>
  17.  
  18. <%@page contentType="text/html; charset=UTF-8"%>
  19. <%@page pageEncoding="UTF-8"%>
  20. <%@page import="java.util.*"%>
  21.  
  22. <!DOCTYPE html>
  23. <html>
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  26. <title>Validation</title>
  27. <link rel="stylesheet" type="text/css" href="style.css" />
  28. <link rel="icon" href="favicon.png">
  29. </head>
  30. <body>
  31. <div>
  32. <%
  33. String user = request.getParameter("typed_username");
  34. String pass = request.getParameter("typed_password");
  35.  
  36. if(user == null){
  37. out.println("User field is null.");
  38. return;
  39. }
  40. out.println(user);/*This prints the username but the "if" always returns null*/
  41.  
  42. if(pass == null){
  43. out.println("Password field is null.");
  44. return;
  45. }
  46.  
  47. %>
  48. </div>
  49. </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement