Developing a Custom Tag Library for Database Handling

In the preceding chapter, you learned how to create and use simple and nested actions. In this section, you will create a set of co-operating and iterative tags that you can use for database queries and manipulation instead of using JDBC directly.

Connection, User Id, and Password Tags

The connection tag creates a database connection using information such as the URL, name, and password. The user Id and password can be provided as subelements of the connection tag.

<db:connection id="conn" url="jdbc:odbc:auction">
    <db:userId><%= userId%></db:userId>
    <db:password><%= password%></db:password>
</db:connection>

The nested tags set the user ID and password information to create the connection. ...

Get Java Server Pages from scratch 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.