[ Team LiB ] Previous Section Next Section

Using Tag Libraries—Best Practices

Use custom tag libraries in implementing an MVC design pattern. Tag libraries are most effectively used when implementing presentation support behavior specific to JSP pages. Outside of JSP, JSP tags have little or no utility.

Tag libraries should not implement business logic, or common or general behavior. If business logic or common behavior implementations are required, JSP pages via JSP tags should use the services of a business object, such as a JavaBean—again supporting the layer structure of an MVC pattern.

Catalog efficient tag libraries with the goal of building a portfolio of time-saving, efficient, and reusable components. Such a portfolio saves time in routine tasks, especially in the initial stages of a project, by avoiding putting Java code in JSP pages, and by promoting reuse across many JSP pages.

Before implementing your logic, a good search of the previously given tag library resources may yield preexisting functionality that will save you development time.


The GAMS tag library contains two specialized tags: SummaryDisplayItem and DisplayItem. SummaryDisplayItem facilitates the display of general item information. This tag is used exclusively by the finditems JSP page. DisplayItem facilitates the display of detailed item information. This tag is used exclusively by the displayItem JSP page. These components support the MVC design pattern by abstracting implementation away from presentation into easily useable, self-formatting modules.

    [ Team LiB ] Previous Section Next Section