Java Reference
In-Depth Information
Implementing a Login Error Page
The next step we need to do to implement form based authentication is to develop
a page to be displayed when login fails. A common practice is to allow the user to
attempt to log in again from the error page, this practice is followed in our login
error page.
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>Login Error</title>
</head>
<body>
There was an error logging in. Please try again.
<br />
<form method="POST" action="j_security_check">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="right">Username:&nbsp;</td>
<td>
<input type="text" name="j_username">
</td>
</tr>
<tr>
<td align="right">Password:&nbsp;</td>
<td><input type="password" name="j_password"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="Login"></td>
</tr>
</table>
</form>
</body>
</html>
If a user enters incorrect credentials when attempting to log in to our application,
he/she will automatically be directed to this page. In our particular implementation
of the login error page, we chose to display an error message and allow the user to
try to log in again (a fairly common practice).
 
Search WWH ::




Custom Search