Form authentication mechanism

Another way we can authenticate our users is to develop an HTML form to collect the user's credentials, then delegate authentication to the Java EE Security API. The first step when following this approach is to develop an HTML page where the user can log in to the application, as illustrated in the following example:

<!DOCTYPE html> 
<html> 
    <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
        <title>Login</title> 
    </head> 
    <body> 
        <p>Please enter your username and password to access the            application</p> 
        <form method="POST" action="j_security_check"> 
            <table cellpadding="0" cellspacing="0" border="0"> 
                <tr> 
                    <td align="right">Username: </td> 
                    <td> 
                           <input type="text" name="j_username"> </td> </tr> ...

Get Java EE 8 Application Development 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.