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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.