Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE HTML>
- <html>
- <head>
- <title>Login</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- </head>
- <body>
- <div>
- <form method="POST" action="validate.jsp">
- User: <input type="text" name="typed_username"><br><br>
- Password: <input type="password" name="typed_password" ><br><br>
- <button type="submit">Login</button>
- </form>
- </div>
- </body>
- </html>
- <%@page contentType="text/html; charset=UTF-8"%>
- <%@page pageEncoding="UTF-8"%>
- <%@page import="java.util.*"%>
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>Validation</title>
- <link rel="stylesheet" type="text/css" href="style.css" />
- <link rel="icon" href="favicon.png">
- </head>
- <body>
- <div>
- <%
- String user = request.getParameter("typed_username");
- String pass = request.getParameter("typed_password");
- if(user == null){
- out.println("User field is null.");
- return;
- }
- out.println(user);/*This prints the username but the "if" always returns null*/
- if(pass == null){
- out.println("Password field is null.");
- return;
- }
- %>
- </div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement