Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

9. Using JSTL: Custom tags are powerful > When a JSP uses more than one tag lib...

When a JSP uses more than one tag library

If you want to use more than one tag library in a JSP, do a separate taglib directive for each TLD. There a few issues to keep in mind...

  • Make sure the taglib uri names are unique. In other words, don’t put in more than one directive with the same uri value.

  • Do NOT use a prefix that’s on the reserved list. The reserved prefixes are:

    jsp:

    jspx:

    java:

    javax:

    servlet:

    sun:

    sunw:

Sharpen your pencil

Empty tags

Write in examples of the THREE different ways to invoke a tag that must have an empty body.

(Check your answers by looking back through the chapter. No, we’re not going to tell you the page number.)

  1. __________________________________________________________________

  2. __________________________________________________________________

  3. __________________________________________________________________

Sharpen your pencil

How the JSP, the TLD, and the bean attribute class relate

Fill in the spaces based on the information that you can see in the TLD. Draw arrows to indicate where the different pieces of information are tied together. In other words, for each blank, show exactly where you found the information needed to fill in the blank.

image with no caption

Sharpen your pencil

Test your Tag memory ANSWERS

  1. Fill in the name of the optional attribute.

    image with no caption
  2. Fill in the missing attribute name.

    image with no caption
  3. Fill in the missing attribute name.

    image with no caption

    Note

    The <c:set> tag must have a value, but you could choose to put the value in the body of the tag instead of as an attribute.

  4. Fill in the missing tag names (two different tag types), and the missing attribute name.

    image with no caption

Sharpen your pencil

How the JSP, the TLD, and the bean attribute class relate ANSWERS

image with no caption