blob: 546c2b6f465202a4c9f636524fc6dcf280079ae7 [file] [log] [blame]
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
\<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.61 [en] (WinNT; I) [Netscape]">
<meta name="Author" content="Anil K. Vijendran">
<title>JSP Examples</title>
<!--
Copyright (c) 1999 The Apache Software Foundation. All rights
reserved.
-->
</head>
<body bgcolor="#FFFFFF">
<b><font face="Arial, Helvetica, sans-serif"><font size=+2>JSP
Samples</font></font></b>
<p>This is a collection of samples demonstrating the usage of different
parts of the Java Server Pages (JSP) specification. Both JSP 2.0 and
JSP 1.2 examples are presented below.
<p>These examples will only work when these pages are being served by a
servlet engine; of course, we recommend
<a href="http://jakarta.apache.org/tomcat/">Tomcat</a>.
They will not work if you are viewing these pages via a
"file://..." URL.
<p>To navigate your way through the examples, the following icons will
help:
<br>&nbsp;
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
<tr VALIGN=TOP>
<td WIDTH="30"><img SRC="images/execute.gif" ></td>
<td>Execute the example</td>
</tr>
<tr VALIGN=TOP>
<td WIDTH="30"><img SRC="images/code.gif" height=24 width=24></td>
<td>Look at the source code for the example</td>
</tr>
<!--<tr VALIGN=TOP>
<td WIDTH="30"><img SRC="images/read.gif" height=24 width=24></td>
<td>Read more about this feature</td>
-->
</tr>
<tr VALIGN=TOP>
<td WIDTH="30"><img SRC="images/return.gif" height=24 width=24></td>
<td>Return to this screen</td>
</tr>
</table>
<p>Tip: For session scoped beans to work, the cookies must be enabled.
This can be done using browser options.
<br>&nbsp;
<br>
<b><u><font size="+1">JSP 2.0 Examples</font></u></b><br>
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
<tr valign=TOP>
<td><b>Expression Language</b></td>
</tr>
<tr valign=TOP>
<td>Basic Arithmetic</td>
<td valign=TOP width="30%"><a href="jsp2/el/basic-arithmetic.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/basic-arithmetic.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/el/basic-arithmetic.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/basic-arithmetic.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Basic Comparisons</td>
<td valign=TOP width="30%"><a href="jsp2/el/basic-comparisons.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/basic-comparisons.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/el/basic-comparisons.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/basic-comparisons.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Implicit Objects</td>
<td valign=TOP width="30%"><a href="jsp2/el/implicit-objects.jsp?foo=bar"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/implicit-objects.jsp?foo=bar">Execute</a></td>
<td width="30%"><a href="jsp2/el/implicit-objects.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/implicit-objects.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Functions</td>
<td valign=TOP width="30%"><a href="jsp2/el/functions.jsp?foo=JSP+2.0"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/functions.jsp?foo=JSP+2.0">Execute</a></td>
<td width="30%"><a href="jsp2/el/functions.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/functions.html">Source</a></td>
</tr>
<tr valign=TOP>
<td><br><b>SimpleTag Handlers and JSP Fragments</b></td>
</tr>
<tr valign=TOP>
<td>Hello World Tag</td>
<td valign=TOP width="30%"><a href="jsp2/simpletag/hello.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/simpletag/hello.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/simpletag/hello.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/simpletag/hello.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Repeat Tag</td>
<td valign=TOP width="30%"><a href="jsp2/simpletag/repeat.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/simpletag/repeat.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/simpletag/repeat.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/simpletag/repeat.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Book Example</td>
<td valign=TOP width="30%"><a href="jsp2/simpletag/book.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/simpletag/book.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/simpletag/book.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/simpletag/book.html">Source</a></td>
</tr>
<tr valign=TOP>
<td><br><b>Tag Files</b></td>
</tr>
<tr valign=TOP>
<td>Hello World Tag File</td>
<td valign=TOP width="30%"><a href="jsp2/tagfiles/hello.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/tagfiles/hello.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/tagfiles/hello.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/tagfiles/hello.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Panel Tag File</td>
<td valign=TOP width="30%"><a href="jsp2/tagfiles/panel.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/tagfiles/panel.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/tagfiles/panel.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/tagfiles/panel.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Display Products Example</td>
<td valign=TOP width="30%"><a href="jsp2/tagfiles/products.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/tagfiles/products.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/tagfiles/products.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/tagfiles/products.html">Source</a></td>
</tr>
<tr valign=TOP>
<td><br><b>New JSP XML Syntax (.jspx)</b></td>
</tr>
<tr valign=TOP>
<td>XHTML Basic Example</td>
<td valign=TOP width="30%"><a href="jsp2/jspx/basic.jspx"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspx/basic.jspx">Execute</a></td>
<td width="30%"><a href="jsp2/jspx/basic.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspx/basic.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>SVG (Scalable Vector Graphics)</td>
<td valign=TOP width="30%"><a href="jsp2/jspx/svgexample.html"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspx/svgexample.html">Execute</a></td>
<td width="30%"><a href="jsp2/jspx/textRotate.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspx/textRotate.html">Source</a></td>
</tr>
<tr valign=TOP>
<td><br><b>Other JSP 2.0 Features</b></td>
</tr>
<tr valign=TOP>
<td>&lt;jsp:attribute&gt; and &lt;jsp:body&gt;</td>
<td valign=TOP width="30%"><a href="jsp2/jspattribute/jspattribute.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspattribute/jspattribute.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/jspattribute/jspattribute.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspattribute/jspattribute.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Shuffle Example</td>
<td valign=TOP width="30%"><a href="jsp2/jspattribute/shuffle.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/jspattribute/shuffle.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/jspattribute/shuffle.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/jspattribute/shuffle.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>Attributes With Dynamic Names</td>
<td valign=TOP width="30%"><a href="jsp2/misc/dynamicattrs.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/misc/dynamicattrs.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/misc/dynamicattrs.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/misc/dynamicattrs.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>JSP Configuration</td>
<td valign=TOP width="30%"><a href="jsp2/misc/config.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/misc/config.jsp">Execute</a></td>
<td width="30%"><a href="jsp2/misc/config.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/misc/config.html">Source</a></td>
</tr>
</table>
<br>
<b><u><font size="+1">JSP 1.2 Examples</font></u></b><br>
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
<tr VALIGN=TOP>
<td>Numberguess&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="num/numguess.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="num/numguess.jsp">Execute</a></td>
<td WIDTH="30%"><a href="num/numguess.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="num/numguess.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Date&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="dates/date.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="dates/date.jsp">Execute</a></td>
<td WIDTH="30%"><a href="dates/date.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="dates/date.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Snoop</td>
<td WIDTH="30%"><a href="snp/snoop.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="snp/snoop.jsp">Execute</a></td>
<td WIDTH="30%"><a href="snp/snoop.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="snp/snoop.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>ErrorPage&nbsp;</td>
<td WIDTH="30%"><a href="error/error.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="error/error.html">Execute</a></td>
<td WIDTH="30%"><a href="error/er.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="error/er.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Carts&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="sessions/carts.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="sessions/carts.html">Execute</a></td>
<td WIDTH="30%"><a href="sessions/crt.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="sessions/crt.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Checkbox&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="checkbox/check.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="checkbox/check.html">Execute</a></td>
<td WIDTH="30%"><a href="checkbox/cresult.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="checkbox/cresult.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Color&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="colors/colors.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="colors/colors.html">Execute</a></td>
<td WIDTH="30%"><a href="colors/clr.html.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="colors/clr.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Calendar&nbsp;</td>
<td WIDTH="30%"><a href="cal/login.html"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="cal/login.html">Execute</a></td>
<td WIDTH="30%"><a href="cal/calendar.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="cal/calendar.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Include&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="/include/include.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="include/include.jsp">Execute</a></td>
<td WIDTH="30%"><a href="include/inc.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="include/inc.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Forward&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="forward/forward.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="forward/forward.jsp">Execute</a></td>
<td WIDTH="30%"><a href="forward/fwd.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="forward/fwd.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Plugin&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="plugin/plugin.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="plugin/plugin.jsp">Execute</a></td>
<td WIDTH="30%"><a href="plugin/plugin.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="plugin/plugin.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>JSP-Servlet-JSP&nbsp;</td>
<td VALIGN=TOP WIDTH="30%"><a href="jsptoserv/jsptoservlet.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="jsptoserv/jsptoservlet.jsp">Execute</a></td>
<td WIDTH="30%"><a href="jsptoserv/jts.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsptoserv/jts.html">Source</a></td>
</tr>
<tr VALIGN=TOP>
<td>Custom tag example</td>
<td VALIGN=TOP WIDTH="30%"><a href="simpletag/foo.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a><a href="simpletag/foo.jsp">Execute</a></td>
<td WIDTH="30%"><a href="simpletag/foo.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="simpletag/foo.html">Source</a></td>
</tr>
<tr valign=TOP>
<td>XML syntax example</td>
<td valign=TOP width="30%"><a href="xml/xml.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="xml/xml.jsp">Execute</a></td>
<td width="30%"><a href="xml/xml.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="xml/xml.html">Source</a></td>
</tr>
</table>
<br/>
<b><u><font size="+1">Tag Plugins</font></u></b><br>
<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
<tr VALIGN=TOP>
<td>If&nbsp;</td>
<td VALIGN=TOP WIDTH="30%">
<a href="tagplugin/if.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0
align=TOP></a>
<a href="tagplugin/if.jsp">Execute</a>
</td>
<td WIDTH="30%">
<a href="tagplugin/if.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 hei
ght=24 width=24 align=TOP></a>
<a href="tagplugin/if.html">Source</a>
</td>
</tr>
<tr VALIGN=TOP>
<td>ForEach&nbsp;</td>
<td VALIGN=TOP WIDTH="30%">
<a href="tagplugin/foreach.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0
align=TOP></a>
<a href="tagplugin/foreach.jsp">Execute</a>
</td>
<td WIDTH="30%">
<a href="tagplugin/foreach.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 hei
ght=24 width=24 align=TOP></a>
<a href="tagplugin/foreach.html">Source</a>
</td>
</tr>
<tr VALIGN=TOP>
<td>Choose&nbsp;</td>
<td VALIGN=TOP WIDTH="30%">
<a href="tagplugin/choose.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP></a>
<a href="tagplugin/choose.jsp">Execute</a>
</td>
<td WIDTH="30%">
<a href="tagplugin/choose.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a>
<a href="tagplugin/choose.html">Source</a>
</td>
</tr>
</table>
</body>
</html>