Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. if(username.equals(username)&&(password.equalsIgnoreCase(password))
  2.  
  3. <form method="POST" action="j_security_check">
  4. <table cellpadding="0" cellspasing="0" border="0">
  5. <tr>
  6. <td align="right">Username:&nbsp;</td>
  7. <td>
  8. <input type="text" name="j_username">
  9. </td>
  10. </tr>
  11. <tr>
  12. <td align="right">Password:&nbsp;</td>
  13. <td>
  14. <input type="password" name="j_password">
  15. </td>
  16. </tr>
  17. <tr>
  18. <td></td>
  19. <td><input type="submit" value="Login"</td>
  20. </tr>
  21. </table>
  22. </form>
  23.  
  24. <title>Login Error</title>
  25. </head>
  26. <body>
  27. There was an error logging in. Please try again.
  28. </body>
  29.  
  30. <body>
  31. <h2>Admin Page</h2>
  32. <p>
  33. Had this been a real admin page, you would have
  34. been able to administer the system from here!
  35. </p>
  36. </body>
  37.  
  38. String username = request.getParameter("j_username");
  39. String password = request.getParameter("j_password");
  40. RequestDispatcher rd = null;
  41.  
  42. if (username.equals(username) && password.equalsIgnoreCase(password)) {
  43. rd = request.getRequestDispatcher("/success.jsp");
  44. User user = new User(username, password);
  45. request.setAttribute("user", user);
  46. } else {
  47. rd = request.getRequestDispatcher("/error.jsp");
  48. }
  49. rd.forward(request, response);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement