7.2. Example: Form-Based Authentication

In this section I’ll work through a small Web site for a fictional company called hot-dot-com.com. I’ll start by showing the home page, then list the web.xml file, summarize the various protection mechanisms, show the password file, present the login and login-failure pages, and give the code for each of the protected resources.

The Home Page

Listing 7.7 shows the top-level home page for the Web application. The application is registered with a URL prefix of /hotdotcom so the home page can be accessed with the URL http://host/hotdotcom/index.jsp as shown in Figure 7-3. If you’ve forgotten how to assign URL prefixes to Web applications, review Section 4.1 (Registering Web Applications).

Figure 7-3. Home ...

Get More Servlets and JavaServer Pages™ 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.