Documentation for the JSPSPEC Tag Library

1. INTRODUCTION

The JSPSPEC custom tag library contains working examples of the tags described in the JavaServerPages specification, Version 1.1. As such, the tags are focused more on being examples of custom tag library code techniques, and less on being useful in production applications.

2. PREREQUISITE SOFTWARE

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1.

3. CONFIGURATION INFORMATION

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

    <%@ taglib uri="http://jakarta.apache.org/taglibs/jspspec-1.0" prefix="x" %>
where "x" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

4. TAG DOCUMENTATION

This custom tag library includes several tags, with the following characteristics:

4.1 The "foo" tag

This tag does nothing, but serves as an illustration of the simplest possible tag that can be constructed. It is described in Section A.1.1 of the spec.

Attribute Description Required
att1 The first attribute for this tag. It can take any string value. Yes
att2 The second attribute for this tag. It can take any string value. Yes
att3 The third attribute for this tag. It can take any string value. Yes

4.2 The "bar" tag

This tag is similar to the "foo" tag, but it also creates a new scripting variable, with a name specified by the id attribute. In this case the scripting variable is a String, but in general a custom tag can create zero or more objects of any Java class. This tag is described in Section A.1.2 of the spec.

Attribute Description Required
id The name of the scripting variable to be created. This name must conform to the scripting language (normally Java) rules for variable names, and must be unique within the page. If not specified, mybar will be the assigned name. No
att1 The first attribute for this tag. It can take any string value. Yes
att2 The second attribute for this tag. It can take any string value. Yes
att3 The third attribute for this tag. It can take any string value. Yes

5. USAGE EXAMPLES

See the example application (jspspec/jspspec-examples.war) for examples of the usage of the tags from this custom tag library.