Guest User

Untitled

a guest
Jan 11th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. <%@page import = "java.util.*" %>
  2. <%@page import = "java.lang.*" %>
  3.  
  4. <%@page errorPage="err.jsp" %>
  5.  
  6. <html>
  7.  
  8. <title>
  9.  
  10. LOGIN
  11.  
  12. </title>
  13.  
  14. <body>
  15.  
  16. <form name = "myForm" method = "GET".
  17.  
  18. <%! String usename;
  19.  
  20. String Password;
  21.  
  22. String returnDate()
  23.  
  24. {
  25.  
  26. Date today = new Date();
  27.  
  28. return today.toString();
  29.  
  30. }
  31.  
  32. %>
  33.  
  34. <br>
  35.  
  36. <br>
  37.  
  38. Username: <input type = "textbox" name = "un"
  39.  
  40. value: size = "25">
  41.  
  42. <br>
  43.  
  44. <br>
  45.  
  46. Password: <input type = "password" name = "pwd">
  47.  
  48. <p>
  49.  
  50. <input type = "submit" value = "login">
  51.  
  52. <input type = "reset">
  53.  
  54. </form>
  55.  
  56.  
  57.  
  58. <%
  59.  
  60. String user = request.getParameter("un");
  61.  
  62. String pwd = request.getParameter("pwd");
  63.  
  64. if(user!=null && pwd!=null)
  65.  
  66. {
  67.  
  68. if("Vj".equals(user) && "Teja".equals(pwd))
  69.  
  70. {
  71.  
  72. out.println("Authentication complete");
  73.  
  74. }
  75.  
  76. else
  77.  
  78. {
  79.  
  80. throw new Exception("Login Failure");
  81.  
  82. }
  83.  
  84.  
  85.  
  86. }
  87.  
  88. %>
  89.  
  90.  
  91.  
  92. </html>
  93.  
  94. <%@ page isErrorPage="true" import="java.io.*" %>
  95. <html>
  96. <body>
  97. <h2>Error Encountered!</h2>
  98. <font color="red"><%= exception %> has been encountered.</font>
  99. </body>
  100. </html>
Add Comment
Please, Sign In to add comment