You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-dev@jakarta.apache.org by cr...@locus.apache.org on 2000/04/10 02:55:48 UTC
cvs commit: jakarta-taglibs/jspspec/examples/web index.jsp
craigmcc 00/04/09 17:55:48
Added: jspspec/conf taglib.tld
jspspec/doc/conf web.xml
jspspec/doc/web index.html
jspspec/examples/conf web.xml
jspspec/examples/web index.jsp
Log:
Add initial set of files for the "jspspec" custom tag library:
- Tag library descriptor
- Documentation application
- Examples application
Revision Changes Path
1.1 jakarta-taglibs/jspspec/conf/taglib.tld
Index: taglib.tld
===================================================================
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib
PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">
<taglib>
<!-- The version number of this tag library -->
<tlibversion>1.0</tlibversion>
<!-- The JSP specification version required to function -->
<jspversion>1.1</jspversion>
<!-- The short name of this tag library -->
<shortname>JSP Specification Tag Library Examples</shortname>
<!-- Public URI that uniquely identifies this version of the tag library -->
<uri>http://jakarta.apache.org/taglibs/jspspec-1.0</uri>
<!-- General information about this tag library -->
<info>
The "jspspec" tag library contains working implementations of the tags
used as examples within the JSP Specification, version 1.1.
</info>
<!-- ******************** Defined Custom Tags *************************** -->
<tag>
<name>foo</name>
<tagclass>org.apache.taglibs.jspspec.FooTag</tagclass>
<info>
Example tag from Section A.1.1 of the JSP Specification, version 1.1.
</info>
<attribute>
<name>att1</name>
<required>true</required>
</attribute>
<attribute>
<name>att2</name>
<required>true</required>
</attribute>
<attribute>
<name>att3</name>
<required>true</required>
</attribute>
</tag>
<tag>
<name>bar</name>
<tagclass>org.apache.taglibs.jspspec.BarTag</tagclass>
<teiclass>org.apache.taglibs.jspspec.BarTagExtraInfo</teiclass>
<info>
Example tag from Section A.1.2 of the JSP Specification, version 1.1.
</info>
<attribute>
<name>id</name>
<required>false</required>
</attribute>
<attribute>
<name>att1</name>
<required>true</required>
</attribute>
<attribute>
<name>att2</name>
<required>true</required>
</attribute>
<attribute>
<name>att3</name>
<required>true</required>
</attribute>
</tag>
</taglib>
1.1 jakarta-taglibs/jspspec/doc/conf/web.xml
Index: web.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<description>
Documentation for the "jspspec" custom tag library,
from the JAKARTA-TAGLIBS project.
</description>
</web-app>
1.1 jakarta-taglibs/jspspec/doc/web/index.html
Index: index.html
===================================================================
<html>
<head>
<title>Documentation for the JSPSPEC Tag Library</title>
</head>
<body bgcolor="white">
<div align="center">
<h1>Documentation for the JSPSPEC Tag Library</h1>
</div>
<h2>1. INTRODUCTION</h2>
<p>The <i>JSPSPEC</i> 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.
<h2>2. PREREQUISITE SOFTWARE</h2>
<p>This custom tag library requires no software other than a servlet container
that supports the JavaServer Pages Specification, version 1.1.
<h2>3. CONFIGURATION INFORMATION</h2>
<p>Follow these steps to configure your web application with this tag library:
<ul>
<li>Copy the tag library descriptor file (<code>jspspec/jspspec.tld</code>)
to the <code>/WEB-INF</code> subdirectory of your web application.
<li>Copy the tag library JAR file (<code>jspspec/jspspec.jar</code>) to the
<code>/WEB-INF/lib</code> subdirectory of your web application.
<li>Add a <code><taglib></code> element to your web application
deployment descriptor in <code>/WEB-INF/web.xml</code> like this:
<pre>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/jspspec-1.0</taglib-uri>
<taglib-location>/WEB-INF/jspspec.tld</taglib-location>
</taglib>
</pre>
</ul>
<p>To use the tags from this library in your JSP pages, add the following
directive at the top of each page:
<pre>
<%@ taglib uri="http://jakarta.apache.org/taglibs/jspspec-1.0" prefix="x" %>
</pre>
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.
<h2>4. TAG DOCUMENTATION</h2>
<p>This custom tag library includes several tags, with the following
characteristics:
<h3>4.1 The "foo" tag</h3>
<p>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.</p>
<table border="1" width="100%">
<tr>
<th width="20%">Attribute</th>
<th width="60%">Description</th>
<th width="20%">Required</th>
</tr>
<tr>
<td align="center">att1</td>
<td>The first attribute for this tag. It can take any string value.</td>
<td align="center">Yes</td>
</tr>
<tr>
<td align="center">att2</td>
<td>The second attribute for this tag. It can take any string value.</td>
<td align="center">Yes</td>
</tr>
<tr>
<td align="center">att3</td>
<td>The third attribute for this tag. It can take any string value.</td>
<td align="center">Yes</td>
</tr>
</table>
<h3>4.2 The "bar" tag</h3>
<p>This tag is similar to the "foo" tag, but it also creates a new scripting
variable, with a name specified by the <code>id</code> 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.</p>
<table border="1" width="100%">
<tr>
<th width="20%">Attribute</th>
<th width="60%">Description</th>
<th width="20%">Required</th>
</tr>
<tr>
<td align="center">id</td>
<td>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, <code>mybar</code> will be the assigned name.</td>
<td align="center">No</td>
</tr>
<tr>
<td align="center">att1</td>
<td>The first attribute for this tag. It can take any string value.</td>
<td align="center">Yes</td>
</tr>
<tr>
<td align="center">att2</td>
<td>The second attribute for this tag. It can take any string value.</td>
<td align="center">Yes</td>
</tr>
<tr>
<td align="center">att3</td>
<td>The third attribute for this tag. It can take any string value.</td>
<td align="center">Yes</td>
</tr>
</table>
<h2>5. USAGE EXAMPLES</h2>
See the example application (<code>jspspec/jspspec-examples.war</code>) for
examples of the usage of the tags from this custom tag library.
</body>
</html>
1.1 jakarta-taglibs/jspspec/examples/conf/web.xml
Index: web.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2.2.dtd">
<web-app>
<description>
Example web application illustrating the use of tags in the
"jspspec" custom tag library, from the JAKARTA-TAGLIBS project.
</description>
<taglib>
<taglib-uri>http://jakarta.apache.org/taglibs/jspspec-1.0</taglib-uri>
<taglib-location>/WEB-INF/jspspec.tld</taglib-location>
</taglib>
</web-app>
1.1 jakarta-taglibs/jspspec/examples/web/index.jsp
Index: index.jsp
===================================================================
<%@ taglib uri="http://jakarta.apache.org/taglibs/jspspec-1.0" prefix="j" %>
<html>
<head>
<title>Examples of JSPSPEC Custom Tag Library Tag Usage</title>
</head>
<body bgcolor="white">
The <b>jspspec</b> tag library contains working examples of the custom tags
described in the JavaServer Pages Specification, version 1.1.
<hr>
The <i>foo</i> tag presents no tangible result, although it is used here.
<j:foo att1="first" att2="second" att3="third"/>
<hr>
The <i>bar</i> tag defines a new scripting object that is visible
throughout the remainder of the current page. The name of the
scripting variable is the value of the <code>id</code> attribute.
<j:bar id="newbean" att1="First attribute" att2="Second" att3="3rd"/>
<br><br>
The value of the scripting variable constructed by this tag is:
'<b><%= newbean %></b>'.
<hr>
</body>
</html>