Tag Files: like include, only better

With Tag Files, you can invoke reusable content using a custom tag instead of the generic <jsp:include> or <c:import>. You can think of Tag Files as a kind of “tag handler lite”, because they let page developers create custom tags, without having to write a complicated Java tag handler class, but Tag Files are really just glorified includes.

Simplest way to make and use a Tag File

  1. Take an included file (like “Header.jsp”) and rename it with a .tag extension.

    image with no caption
    image with no caption
  2. Put the tag file (“Header.tag”) in a directory named “tags” inside the “WEB-INF” directory.

    image with no caption
  3. Put a taglib directive (with a tagdir attribute) in the JSP, and invoke the tag.

    image with no caption
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset