Creating a Tag File

See Also

The following steps show how to create a tag file in a web application. After you create the tag file, use code completion in the Source Editor to specify the tag's attributes, body, and behavior.

To create a tag file:

  1. In the Projects window or Files window, right-click the project node.
  2. From the pop-up menu, choose New > Other.
  3. Under Categories, select Web. Under File Types, select Tag File. Click Next.
  4. Type the name of the tag file.
  5. Type the folder where your tag files are housed. By default, they are created in WEB-INF/tags.
  6. Select the type of tag file that you want to create:
  7. (Optional) Click the Create as a Segment of a Tag File checkbox. A segment is a file that contains a fragment of tag file text for inclusion by tag files. Tag segments typically use the .tagf extension.
  8. (Optional) Click the Add Tag File to Tag Library Descriptor checkbox if you want the IDE to create entries in a TLD file for the tag file. If you click this checkbox, you must have a TLD file available. If not, create one first.

    If you clicked the Add Tag File to Tag Library Descriptor checkbox, do the following:

    1. Click Browse to select the tag library descriptor (TLD file) for your tag file. By default, the TLD files are in the WEB-INF/tlds folder.
    2. Type the name of the tag. This is the name you use in the JSP file to refer to the tag file.
  9. Click Finish.

The IDE creates a tag file that conforms to the JSP 2.0 specification.

tip  A tag file is run when the JSP file in which it is defined is deployed. You can set breakpoints in the tag file. Then, when the JSP file is debugged, the tag file is debugged too.

For more information about creating and using tag libraries, see the JavaServer Pages Specification available at

.

See Also
About Tag Files
Accessing a Custom Tag from a JSP Page
About Tag Libraries
About JSP Syntax

Legal Notices