Server : Apache/2.4.43 (Win64) OpenSSL/1.1.1g PHP/7.4.6 System : Windows NT USER-PC 6.1 build 7601 (Windows 7 Professional Edition Service Pack 1) AMD64 User : User ( 0) PHP Version : 7.4.6 Disable Function : NONE Directory : C:/xampp/tomcat/webapps/examples/jsp/ |
<!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You 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> </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="https://tomcat.apache.org/">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> <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> <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>Composite Expressions</td> <td valign=TOP width="30%"><a href="jsp2/el/composite.jsp"><img src="images/execute.gif" hspace=4 border=0 align=top></a><a href="jsp2/el/composite.jsp">Execute</a></td> <td width="30%"><a href="jsp2/el/composite.html"><img SRC="images/code.gif" HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a href="jsp2/el/composite.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><jsp:attribute> and <jsp:body></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 </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 </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 </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 </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 </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 </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"><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 </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 </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 </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 </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 </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 </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 </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 </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> <br/> <b><u><font size="+1">Other Examples</font></u></b><br> <table BORDER=0 CELLSPACING=5 WIDTH="85%" > <tr VALIGN=TOP> <td>FORM Authentication </td> <td VALIGN=TOP WIDTH="30%"> <a href="security/protected/index.jsp"><img SRC="images/execute.gif" HSPACE=4 BORDER=0 align=TOP> Execute</a> </td> <td WIDTH="30%"></td> </tr> <tr> <td colspan="3">Example that demonstrates protecting a resource and using Form-Based authentication. To access the page the user must have role of either "tomcat" or "role1". By default no user is configured to have these roles.</td> </tr> </table> </body> </html>