Creating a Custom Login Form

When you use the FORM authentication method, you must supply a login form to prompt the user for a username and password. The login form must contain form elements named j_username and j_password. The action in the <form> tag must be j_security_check. Listing 37.3 shows the HTML source for an example login form.

Code Listing 37.3. Source Code for LoginForm.html
 <html> <body bgcolor="#ffffff"> <center><img src="banner.jpg"></center> <form action="j_security_check"> <center> <table border="0"> <tr> <td><img src="login.jpg"></td> <td><input type="text" name="j_username"></td> </tr> <tr> <td><img src="password.jpg"></td> <td><input type="password" name="j_password"></td> </tr> </table> <input type="submit" value="Login!"> ...

Get Special Edition Using Java™ 2 Enterprise Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.