站内搜索: 请输入搜索关键词
当前页面: 图书首页 > Servlets and JavaServer Pages: The J2EE Technology Web Tier

Servlets and JavaServer Pages: The J2EE Technology Web Tier

[ directory ]Chapter7.        Custom Tag Libraries Tag Library Basics

Why Custom Tags?

A few points about custom tags have been touched on, but there are many good reasons as to why custom tags are helpful. Before we get to how one goes about building a custom tag, it is helpful to understand why exactly you would want to build one. In summary, here is a formal list of the primary reasons:

A good way to think of a custom tag is as a component, written in either Java or JSP, that encapsulates some behavior. To the page author, custom tags look like HTML, or at the very least XML. To a tag developer, a custom tag can either be a Java class or a fragment of a JSP. In all cases the syntax is very familiar and follows with the strong points of the respective language.

[ directory ]Chapter7.        Custom Tag Libraries Tag Library Basics