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.
This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1.
Follow these steps to configure your web application with this tag library:
jspspec/jspspec.tld
)
to the /WEB-INF
subdirectory of your web application.
jspspec/jspspec.jar
) to the
/WEB-INF/lib
subdirectory of your web application.
<taglib>
element to your web application
deployment descriptor in /WEB-INF/web.xml
like this:
<taglib> <taglib-uri>http://jakarta.apache.org/taglibs/jspspec-1.0</taglib-uri> <taglib-location>/WEB-INF/jspspec.tld</taglib-location> </taglib>
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.
This custom tag library includes several tags, with the following characteristics:
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 |
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 |
jspspec/jspspec-examples.war
) for
examples of the usage of the tags from this custom tag library.