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

Servlets and JavaServer Pages: The J2EE Technology Web Tier

[ directory ]How Are Tags Being Used? Tag Library Descriptors (TLDs)

New and Old Custom Tags

The JSP 2.0 specification was originally named the JSP 1.3 specification, but enough significant changes were introduced that it made sense to promote the new specification to JSP 2.0. Some of the most significant changes that pushed the title change are related directly to JSP custom tags. In previous versions of JSP, custom tags were something that were complex and suited only for Java developers. However, what custom tags did was so helpful that non-Java developers complained that JSP should extend its flexibility to make custom tags easy to use for all JSP authors. Additionally, JSP has been under scrutiny for a long time because many of its features (namely custom tags) can be used well outside the context of HTTP Servlets. JSP 2.0 introduces additions that solve these issues.

Claiming that all of the custom tag functionality introduced in JSP 2.0 is complementary to what already existed is simply not true. Many of the additions are a superior form of building custom tags. The better way to look at JSP 2.0 custom tags is to divide them into two categories: new "simple" custom tags and old custom tags. Both types of tags work and provide identical functionality. The difference between the two types of tags is that the new custom tags provide a more simple and intuitive solution. All custom tags can be used in any combination on the same JSP.

In this book the basic functionality of custom tags is completely covered by this chapter. First, the newer approach of building custom tags is introduced and explained. We would strongly encourage you to use the new simple approach; however, the older approach for implementing custom tags is also covered. It can be left as optional reading, but it is very helpful to understand because almost every existing custom tag was built following the strategy.

[ directory ]How Are Tags Being Used? Tag Library Descriptors (TLDs)