[ Team LiB ] Previous Section Next Section


The Workshop is designed to help you review what you have learned and help you further increase your understanding of the material covered in this hour.



What are some of the advantages of using tags?


What is the primary difference between SimpleTag and classic tag handlers?


What is a JSP fragment?


What is a Tag file?



Tags provide a mechanism for creating natural, reusable elements in JSPs. They also allow you to encapsulate functionality, which makes it possible to develop cleaner, more maintainable applications. Tags can also abstract complex operations.


A SimpleTag has a much simpler invocation protocol with only one method, doTag(). Functionally, they're nearly equivalent.


A JSP fragment is a segment of JSP code intended for use within a larger component.


A Tag file is source file, created using JSP syntax, which is used to produce a tag handler at translation time. It's not necessary to know Java to create a Tag file. Tag files can be deployed by simply copying them to the appropriate location. They have been designed to greatly simplify the creation and deployment of tags.


  1. Write a few tags, using the SimpleTag interface, that provide common functions such as outputting the date and time or formatting text. Use them in a JSP.

  2. Write a custom tag that interfaces to the shopping cart from Hour 13.

    [ Team LiB ] Previous Section Next Section