Child pages
  • Plain HTML login screen example
Skip to end of metadata
Go to start of metadata

Rather than build a login page based on SmartClient or SmartGWT components, we recommend using a plain HTML login page.  This is because a plain HTML login page provides better interoperability with other technology (such as single sign-on systems), will load faster, and provides an opportunity to pre-load application resources while the user types credentials.  This is discussed in more detail in the Data Integration chapter of the QuickStart Guide.

This article shows a simple example of login screen that works with the form-based authentication systems provided by typical servlet engines such as Tomcat and JBoss. The basic HTML code for your login form should be:

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

Here the important considerations are:

  1. The username field is named j_username and password is named j_password.  These are typical default field names for many different Java authentication systems.
  2. The action of the login form is typically j_security_check.

If authentication fails, most authentication systems allow you to provide an error page, the example code available below includes this as well.

You can download a sample login page and error page below.  This includes a login form like the above, with some simple CSS styling to center the form under a background logo.

The source code of this example is available here.

  • No labels


  1. I am particularly interested in leveraging the "pre-load of application resources while the user types credentials".

    But I'm using CAS server for SSO, so my html login page is into another webapp (the CAS server), so preloading in that login page won't work.

    I think that the only viable approach would be having a login page inside the same webapp, and using the REST api of the CAS for authentication. Unfortunately this means also to use an approach which is more "favorable" to attacks...

  2. how can i link those two pages ?? when i try to log in ... this error shows 

    This webpage is not found

    what code should i use ???