When Should JSP Tag Libraries Be Created?
Supporting MVC design patterns, JSP tag libraries should be created to implement application presentation. The tag libraries should interface business objects such as JavaBeans, EJBs, or other generic Java objects required to implement application functionality. JSP tag libraries in conjunction with business objects should theoretically remove all Java code from presentation implementations. Logic previously implemented using scriptlets in individual JSP pages should be encapsulated within objects, and then interfaced via JSP tag libraries. Using the services of the business objects, the tag libraries process and format data for presentation. This construct provides for presentation units that are available across the current application, and reusable in follow-on development. The presentation code produced using this methodology is cleaner; that is, more readable and maintainable than earlier JSP implementations.