JSP Tag Libraries

Скачать в pdf «JSP Tag Libraries»

15.4 Design recommendations


When developing a tag library (as opposed to developing a single tag), you may want to invest extra effort into designing the library so that it better fits your target users. Some of the more useful value-add options are presented in this section.

15.4.1 Opening library internals


Crosby, Stills, Nash, & Young sang, “…If you can’t be with the one you love, love the one you’re with.” The problem with applying this attitude to the JSP world is that loving the tag library you are with is not going to work if you cannot adapt it to your needs.


Even if you believe that your tag library is complete, it’s important to allow users to extend its functionality and document the extension methods. For instance, we can extend our iteration tags by supplying helper objects for the iteration and getting the field values. By documenting this feature, we ensure that whoever purchases our tags will be able to extend them to handle any new requirements that come up.


The same thing applies, of course, to the database library developed in this book. In fact, one fault in our database library is that we execute only queries and do not support updates. The solution to this shortcoming is easy if we open the library interfaces. In this case, a third-party developer could take a database connection created by a connection tag and use it inside an update tag to modify the database.


It is clear that opening the library for third-party changes may require a special license. It may also require a change in the library price model. However, if you are planning to sell the tags or use them in-house, the ability to modify the library will provide users with a substantial advantage in the long run.

Скачать в pdf «JSP Tag Libraries»