Professional Documents
Culture Documents
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
</head>
<body>
Sample login Example (try with username as "admin" and password as "admin" without quart
)<br><br>
</form>
</body>
</html>
PACKAGE:
packagecom.candidjava;
importjava.io.IOException;
importjavax.servlet.ServletException;
importjavax.servlet.http.HttpServlet;
importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;
/**
* Servlet implementation class LoginController
*/
String un=request.getParameter("username");
String pw=request.getParameter("password");
if(un.equals("admin") &&pw.equals("admin"))
response.sendRedirect("success.html");
return;
else
response.sendRedirect("error.html");
return;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
</head>
<body>
Login success
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
</head>
<body>
</body>
</html>