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

Servlets and JavaServer Pages: The J2EE Technology Web Tier

[ directory ]Summary Why Custom Tags?

Chapter 7. Custom Tag Libraries

In Chapter 3, we introduced JavaServer Pages. The introduction focused on the core concepts of JSP and explained how JSP complements Servlets in the J2EE Web tier; however, a very important set of JSP functionality was completely ignoredcustom tags. In Chapter 3 the topic of custom tags, also called custom actions, was avoided in favor of establishing the more fundamental concepts of JSP. Custom tag use is not a topic that can be fully covered by a few pages of discussion. A proper explanation of custom tags easily fills a chapter itself, while full coverage of custom tag uses can easily fill a few more.

In this chapter a complete introduction is given for custom tags. The topics of focus are how to build custom tags and why custom tags are helpful. These two subjects are important to understand before we get too far into the possible use cases for the technology. Being able to design and implement your own set of custom tags is an invaluable skill for a JSP developer to have. This skill can be applied to many different situations as was shown in Chapter 6 and will be shown in the later chapters covering security, internationalization, and multi-client design. Compared to a simple scriptlet, building a custom tag requires a notable amount more effort. If you are to be a good JSP developer, a full understanding of JSP custom tags is needed. This chapter is the foundation of such an understanding.

We discuss the following topics in this chapter:

This is one of the longer chapters; however, you are not expected to read the whole thing straight through. Only the first half of the chapter, all the way through the discussion of "simple" tags and .tag files, and the last few topics, tag library listeners and tag library validation are required; the complete discussion about classic custom tags is provided only for completeness. If you only care to know what is needed for the later chapters of the book (i.e., what you will likely need when developing new Web Applications), feel free to skip the discussion on pre-JSP 2.0 custom tags, but be aware almost all existing custom tag libraries are implemented via classic custom tags. If you want to be a well-informed JSP developer, you will certainly benefit from reading the whole chapter straight through.

[ directory ]Summary Why Custom Tags?