Guest User

question27

a guest
Jul 20th, 2018
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import java.io.IOException;
  2. import java.io.PrintWriter;
  3.  
  4. import javax.servlet.annotation.*;
  5. import javax.servlet.http.*;
  6.  
  7. @WebServlet("/usernameValidate")
  8. public class question27 extends HttpServlet{
  9.  
  10. private static final long serialVersionUID = 1L;
  11.  
  12. public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException {
  13.  
  14.  
  15. String username = req.getParameter("username");
  16. String password = req.getParameter("password");
  17. PrintWriter out = res.getWriter();
  18. out.write("<html><head><title>uservalidation</title></head>");
  19. if(username !="abc") {
  20.  
  21. out.write("your typed username incorrectly. the correct username is abc");
  22. }else {
  23. out.write("your typed username correctly. the correct username is abc");
  24. }
  25. out.write("</html>");
  26. }
  27.  
  28. }
  29.  
  30.  
  31.  
  32. ==================html=========================================
  33.  
  34. <!DOCTYPE html>
  35. <html>
  36. <head>
  37. <meta charset="ISO-8859-1">
  38. <title>Question 27</title>
  39. </head>
  40. <body>
  41.  
  42. <form action="usernameValidate" method="get">
  43. username:<input type="text" name="username" >
  44. password:<input type="password" name="password">
  45. <input name="submit" type="submit">
  46. </form>
  47. </body>
  48. </html>
Add Comment
Please, Sign In to add comment