[ Team LiB ] Previous Section Next Section

Workshop

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.

Quiz

1:

What are some of the advantages of using tags?

2:

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

3:

What is a JSP fragment?

4:

What is a Tag file?


Answers

A1:

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.

A2:

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

A3:

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

A4:

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.


Activities

  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