Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.io.IOException;
- import java.io.PrintWriter;
- import javax.servlet.annotation.*;
- import javax.servlet.http.*;
- @WebServlet("/usernameValidate")
- public class question27 extends HttpServlet{
- private static final long serialVersionUID = 1L;
- public void doGet(HttpServletRequest req,HttpServletResponse res) throws IOException {
- String username = req.getParameter("username");
- String password = req.getParameter("password");
- PrintWriter out = res.getWriter();
- out.write("<html><head><title>uservalidation</title></head>");
- if(username !="abc") {
- out.write("your typed username incorrectly. the correct username is abc");
- }else {
- out.write("your typed username correctly. the correct username is abc");
- }
- out.write("</html>");
- }
- }
- ==================html=========================================
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="ISO-8859-1">
- <title>Question 27</title>
- </head>
- <body>
- <form action="usernameValidate" method="get">
- username:<input type="text" name="username" >
- password:<input type="password" name="password">
- <input name="submit" type="submit">
- </form>
- </body>
- </html>
Add Comment
Please, Sign In to add comment