13.9. A Database-Driven Authentication Servlet
In this section, we will write a complete authentication application. The application is usable almost right out of the box for incorporating into your own Java applications (or your CFMX applications for that matter). The only things you'd need to change are the database name and driver name in the utility class.
The application requires the following components:
An HTML page, which will simply contain a login form. The only interesting thing about this form is where the <form> tag's action attribute points. As mentioned above, we can define servlets to map to any arbitrary string extension we like. Because this book is called Java for ColdFusion Developers, we'll create a mapping in Tomcat's
Get Java™ for ColdFusion® Developers 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.