Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Create a form-based login page is very easy and only you have to follow some important considerations.

You can create a login page in an HTML page, JSP page or Servlet and the basic code should be:

<form method="POST" action="j_security_check">
    <input type="text" name="j_username">
    <input type="password" name="j_password">
</form>
 

Here the important considerations are:

1.- The name of the field of username always be named j_username.

2.- The name of the field of password always be named j_password.

3.- The action of the login form must be j_security_check.

These considerations are very important for that the authentication mechanism correctly works.

Last, comment that you can create an error page as well, because if the authentication fails, the user will be redirected to this page.

Next, some screenshots of this example:


The source code of this example, you can download it here.

  • No labels