Subversion Repositories Integrator Subversion

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
771 blopes 1
<!--
2
 Licensed to the Apache Software Foundation (ASF) under one or more
3
  contributor license agreements.  See the NOTICE file distributed with
4
  this work for additional information regarding copyright ownership.
5
  The ASF licenses this file to You under the Apache License, Version 2.0
6
  (the "License"); you may not use this file except in compliance with
7
  the License.  You may obtain a copy of the License at
8
 
9
      http://www.apache.org/licenses/LICENSE-2.0
10
 
11
  Unless required by applicable law or agreed to in writing, software
12
  distributed under the License is distributed on an "AS IS" BASIS,
13
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
  See the License for the specific language governing permissions and
15
  limitations under the License.
16
-->
17
<!DOCTYPE html><html lang="en">
18
<head>
19
   <meta charset="UTF-8"/>
20
   <title>JSP Examples</title>
21
   <style type="text/css">
22
   img { border: 0; }
23
   th { text-align: left; }
24
   tr { vertical-align: top; }
25
   </style>
26
</head>
27
<body>
28
<h1>JSP
29
Samples</h1>
30
<p>This is a collection of samples demonstrating the usage of different
31
parts of the Java Server Pages (JSP) specification.  Both JSP 2.0 and
32
JSP 1.2 examples are presented below.
33
<p>These examples will only work when these pages are being served by a
34
servlet engine; of course, we recommend
35
<a href="https://tomcat.apache.org/">Tomcat</a>.
36
They will not work if you are viewing these pages via a
37
"file://..." URL.
38
<p>To navigate your way through the examples, the following icons will
39
help:</p>
40
<ul style="list-style-type: none; padding-left: 0;">
41
<li><img src="images/execute.gif" alt=""> Execute the example</li>
42
<li><img src="images/code.gif" alt=""> Look at the source code for the example</li>
43
<li><img src="images/return.gif" alt=""> Return to this screen</li>
44
</ul>
45
 
46
<p>Tip: For session scoped beans to work, the cookies must be enabled.
47
This can be done using browser options.</p>
48
<h2>JSP 2.0 Examples</h2>
49
 
50
<table style="width: 85%;">
51
<tr>
52
<th colspan="3">Expression Language</th>
53
</tr>
54
 
55
<tr>
56
<td>Basic Arithmetic</td>
57
<td style="width: 30%;"><a href="jsp2/el/basic-arithmetic.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/basic-arithmetic.jsp">Execute</a></td>
58
 
59
<td style="width: 30%;"><a href="jsp2/el/basic-arithmetic.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/basic-arithmetic.html">Source</a></td>
60
</tr>
61
 
62
<tr>
63
<td>Basic Comparisons</td>
64
<td style="width: 30%;"><a href="jsp2/el/basic-comparisons.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/basic-comparisons.jsp">Execute</a></td>
65
 
66
<td style="width: 30%;"><a href="jsp2/el/basic-comparisons.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/basic-comparisons.html">Source</a></td>
67
</tr>
68
 
69
<tr>
70
<td>Implicit Objects</td>
71
<td style="width: 30%;"><a href="jsp2/el/implicit-objects.jsp?foo=bar"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/implicit-objects.jsp?foo=bar">Execute</a></td>
72
 
73
<td style="width: 30%;"><a href="jsp2/el/implicit-objects.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/implicit-objects.html">Source</a></td>
74
</tr>
75
<tr>
76
 
77
<td>Functions</td>
78
<td style="width: 30%;"><a href="jsp2/el/functions.jsp?foo=JSP+2.0"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/functions.jsp?foo=JSP+2.0">Execute</a></td>
79
 
80
<td style="width: 30%;"><a href="jsp2/el/functions.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/functions.html">Source</a></td>
81
</tr>
82
 
83
<tr>
84
<td>Composite Expressions</td>
85
<td style="width: 30%;"><a href="jsp2/el/composite.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/el/composite.jsp">Execute</a></td>
86
 
87
<td style="width: 30%;"><a href="jsp2/el/composite.html"><img src="images/code.gif" alt=""></a><a href="jsp2/el/composite.html">Source</a></td>
88
</tr>
89
 
90
 
91
<tr>
92
<th colspan="3"><br />SimpleTag Handlers and JSP Fragments</th>
93
</tr>
94
 
95
<tr>
96
<td>Hello World Tag</td>
97
<td style="width: 30%;"><a href="jsp2/simpletag/hello.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/hello.jsp">Execute</a></td>
98
 
99
<td style="width: 30%;"><a href="jsp2/simpletag/hello.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/hello.html">Source</a></td>
100
</tr>
101
 
102
<tr>
103
<td>Repeat Tag</td>
104
<td style="width: 30%;"><a href="jsp2/simpletag/repeat.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/repeat.jsp">Execute</a></td>
105
 
106
<td style="width: 30%;"><a href="jsp2/simpletag/repeat.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/repeat.html">Source</a></td>
107
</tr>
108
 
109
<tr>
110
<td>Book Example</td>
111
<td style="width: 30%;"><a href="jsp2/simpletag/book.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/simpletag/book.jsp">Execute</a></td>
112
 
113
<td style="width: 30%;"><a href="jsp2/simpletag/book.html"><img src="images/code.gif" alt=""></a><a href="jsp2/simpletag/book.html">Source</a></td>
114
</tr>
115
 
116
<tr>
117
<th colspan="3"><br />Tag Files</th>
118
</tr>
119
 
120
<tr>
121
<td>Hello World Tag File</td>
122
<td style="width: 30%;"><a href="jsp2/tagfiles/hello.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/hello.jsp">Execute</a></td>
123
 
124
<td style="width: 30%;"><a href="jsp2/tagfiles/hello.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/hello.html">Source</a></td>
125
</tr>
126
 
127
<tr>
128
<td>Panel Tag File</td>
129
<td style="width: 30%;"><a href="jsp2/tagfiles/panel.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/panel.jsp">Execute</a></td>
130
 
131
<td style="width: 30%;"><a href="jsp2/tagfiles/panel.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/panel.html">Source</a></td>
132
</tr>
133
 
134
<tr>
135
<td>Display Products Example</td>
136
<td style="width: 30%;"><a href="jsp2/tagfiles/products.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/tagfiles/products.jsp">Execute</a></td>
137
 
138
<td style="width: 30%;"><a href="jsp2/tagfiles/products.html"><img src="images/code.gif" alt=""></a><a href="jsp2/tagfiles/products.html">Source</a></td>
139
</tr>
140
 
141
<tr>
142
<th colspan="3"><br />New JSP XML Syntax (.jspx)</th>
143
</tr>
144
 
145
<tr>
146
<td>XHTML Basic Example</td>
147
<td style="width: 30%;"><a href="jsp2/jspx/basic.jspx"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspx/basic.jspx">Execute</a></td>
148
 
149
<td style="width: 30%;"><a href="jsp2/jspx/basic.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspx/basic.html">Source</a></td>
150
</tr>
151
 
152
<tr>
153
<td>SVG (Scalable Vector Graphics)</td>
154
<td style="width: 30%;"><a href="jsp2/jspx/svgexample.html"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspx/svgexample.html">Execute</a></td>
155
 
156
<td style="width: 30%;"><a href="jsp2/jspx/textRotate.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspx/textRotate.html">Source</a></td>
157
</tr>
158
 
159
<tr>
160
<th colspan="3"><br />Other JSP 2.0 Features</th>
161
</tr>
162
 
163
<tr>
164
<td>&lt;jsp:attribute&gt; and &lt;jsp:body&gt;</td>
165
<td style="width: 30%;"><a href="jsp2/jspattribute/jspattribute.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspattribute/jspattribute.jsp">Execute</a></td>
166
 
167
<td style="width: 30%;"><a href="jsp2/jspattribute/jspattribute.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspattribute/jspattribute.html">Source</a></td>
168
</tr>
169
 
170
<tr>
171
<td>Shuffle Example</td>
172
<td style="width: 30%;"><a href="jsp2/jspattribute/shuffle.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/jspattribute/shuffle.jsp">Execute</a></td>
173
 
174
<td style="width: 30%;"><a href="jsp2/jspattribute/shuffle.html"><img src="images/code.gif" alt=""></a><a href="jsp2/jspattribute/shuffle.html">Source</a></td>
175
</tr>
176
 
177
<tr>
178
<td>Attributes With Dynamic Names</td>
179
<td style="width: 30%;"><a href="jsp2/misc/dynamicattrs.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/misc/dynamicattrs.jsp">Execute</a></td>
180
 
181
<td style="width: 30%;"><a href="jsp2/misc/dynamicattrs.html"><img src="images/code.gif" alt=""></a><a href="jsp2/misc/dynamicattrs.html">Source</a></td>
182
</tr>
183
 
184
<tr>
185
<td>JSP Configuration</td>
186
<td style="width: 30%;"><a href="jsp2/misc/config.jsp"><img src="images/execute.gif" alt=""></a><a href="jsp2/misc/config.jsp">Execute</a></td>
187
 
188
<td style="width: 30%;"><a href="jsp2/misc/config.html"><img src="images/code.gif" alt=""></a><a href="jsp2/misc/config.html">Source</a></td>
189
</tr>
190
 
191
</table>
192
 
193
<h2>JSP 1.2 Examples</h2>
194
<table style="width: 85%;">
195
<tr>
196
<td>Numberguess</td>
197
 
198
<td style="width: 30%;"><a href="num/numguess.jsp"><img src="images/execute.gif" alt=""></a><a href="num/numguess.jsp">Execute</a></td>
199
 
200
<td style="width: 30%;"><a href="num/numguess.html"><img src="images/code.gif" alt=""></a><a href="num/numguess.html">Source</a></td>
201
</tr>
202
 
203
<tr>
204
<td>Date</td>
205
 
206
<td style="width: 30%;"><a href="dates/date.jsp"><img src="images/execute.gif" alt=""></a><a href="dates/date.jsp">Execute</a></td>
207
 
208
<td style="width: 30%;"><a href="dates/date.html"><img src="images/code.gif" alt=""></a><a href="dates/date.html">Source</a></td>
209
</tr>
210
 
211
<tr>
212
<td>Snoop</td>
213
 
214
<td style="width: 30%;"><a href="snp/snoop.jsp"><img src="images/execute.gif" alt=""></a><a href="snp/snoop.jsp">Execute</a></td>
215
 
216
<td style="width: 30%;"><a href="snp/snoop.html"><img src="images/code.gif" alt=""></a><a href="snp/snoop.html">Source</a></td>
217
</tr>
218
 
219
<tr>
220
<td>ErrorPage</td>
221
 
222
<td style="width: 30%;"><a href="error/error.html"><img src="images/execute.gif" alt=""></a><a href="error/error.html">Execute</a></td>
223
 
224
<td style="width: 30%;"><a href="error/er.html"><img src="images/code.gif" alt=""></a><a href="error/er.html">Source</a></td>
225
</tr>
226
 
227
<tr>
228
<td>Carts</td>
229
 
230
<td style="width: 30%;"><a href="sessions/shopping.jsp"><img src="images/execute.gif" alt=""></a><a href="sessions/shopping.jsp">Execute</a></td>
231
 
232
<td style="width: 30%;"><a href="sessions/crt.html"><img src="images/code.gif" alt=""></a><a href="sessions/crt.html">Source</a></td>
233
</tr>
234
 
235
<tr>
236
<td>Checkbox</td>
237
 
238
<td style="width: 30%;"><a href="checkbox/check.html"><img src="images/execute.gif" alt=""></a><a href="checkbox/check.html">Execute</a></td>
239
 
240
<td style="width: 30%;"><a href="checkbox/cresult.html"><img src="images/code.gif" alt=""></a><a href="checkbox/cresult.html">Source</a></td>
241
</tr>
242
 
243
<tr>
244
<td>Color</td>
245
 
246
<td style="width: 30%;"><a href="colors/colors.html"><img src="images/execute.gif" alt=""></a><a href="colors/colors.html">Execute</a></td>
247
 
248
<td style="width: 30%;"><a href="colors/clr.html"><img src="images/code.gif" alt=""></a><a href="colors/clr.html">Source</a></td>
249
</tr>
250
 
251
<tr>
252
<td>Include</td>
253
 
254
<td style="width: 30%;"><a href="include/include.jsp"><img src="images/execute.gif" alt=""></a><a href="include/include.jsp">Execute</a></td>
255
 
256
<td style="width: 30%;"><a href="include/inc.html"><img src="images/code.gif" alt=""></a><a href="include/inc.html">Source</a></td>
257
</tr>
258
 
259
<tr>
260
<td>Forward</td>
261
 
262
<td style="width: 30%;"><a href="forward/forward.jsp"><img src="images/execute.gif" alt=""></a><a href="forward/forward.jsp">Execute</a></td>
263
 
264
<td style="width: 30%;"><a href="forward/fwd.html"><img src="images/code.gif" alt=""></a><a href="forward/fwd.html">Source</a></td>
265
</tr>
266
 
267
<tr>
268
<td>JSP-Servlet-JSP</td>
269
 
270
<td style="width: 30%;"><a href="jsptoserv/jsptoservlet.jsp"><img src="images/execute.gif" alt=""></a><a href="jsptoserv/jsptoservlet.jsp">Execute</a></td>
271
 
272
<td style="width: 30%;"><a href="jsptoserv/jts.html"><img src="images/code.gif" alt=""></a><a href="jsptoserv/jts.html">Source</a></td>
273
</tr>
274
 
275
<tr>
276
<td>Custom tag example</td>
277
 
278
<td style="width: 30%;"><a href="simpletag/foo.jsp"><img src="images/execute.gif" alt=""></a><a href="simpletag/foo.jsp">Execute</a></td>
279
 
280
<td style="width: 30%;"><a href="simpletag/foo.html"><img src="images/code.gif" alt=""></a><a href="simpletag/foo.html">Source</a></td>
281
</tr>
282
 
283
<tr>
284
<td>XML syntax example</td>
285
<td style="width: 30%;"><a href="xml/xml.jsp"><img src="images/execute.gif" alt=""></a><a href="xml/xml.jsp">Execute</a></td>
286
 
287
<td style="width: 30%;"><a href="xml/xml.html"><img src="images/code.gif" alt=""></a><a href="xml/xml.html">Source</a></td>
288
</tr>
289
 
290
</table>
291
 
292
<h2>Tag Plugins</h2>
293
<table style="width: 85%;">
294
 
295
<tr>
296
  <td>If</td>
297
  <td style="width: 30%;">
298
    <a href="tagplugin/if.jsp"><img src="images/execute.gif" alt=""></a>
299
    <a href="tagplugin/if.jsp">Execute</a>
300
  </td>
301
  <td style="width: 30%;">
302
    <a href="tagplugin/if.html"><img src="images/code.gif" alt=""></a>
303
    <a href="tagplugin/if.html">Source</a>
304
  </td>
305
</tr>
306
 
307
<tr>
308
  <td>ForEach</td>
309
  <td style="width: 30%;">
310
    <a href="tagplugin/foreach.jsp"><img src="images/execute.gif" alt=""></a>
311
    <a href="tagplugin/foreach.jsp">Execute</a>
312
  </td>
313
  <td style="width: 30%;">
314
    <a href="tagplugin/foreach.html"><img src="images/code.gif" alt=""></a>
315
    <a href="tagplugin/foreach.html">Source</a>
316
  </td>
317
</tr>
318
 
319
<tr>
320
  <td>Choose</td>
321
  <td style="width: 30%;">
322
    <a href="tagplugin/choose.jsp"><img src="images/execute.gif" alt=""></a>
323
    <a href="tagplugin/choose.jsp">Execute</a>
324
  </td>
325
  <td style="width: 30%;">
326
    <a href="tagplugin/choose.html"><img src="images/code.gif" alt=""></a>
327
    <a href="tagplugin/choose.html">Source</a>
328
  </td>
329
</tr>
330
 
331
</table>
332
 
333
<h2>Other Examples</h2>
334
<table style="width: 85%;">
335
 
336
<tr>
337
  <td>FORM Authentication</td>
338
  <td style="width: 30%;">
339
    <a href="security/protected/index.jsp"><img src="images/execute.gif" alt=""> Execute</a>
340
  </td>
341
  <td style="width: 30%;"></td>
342
</tr>
343
<tr>
344
  <td colspan="3">Example that demonstrates protecting a resource and
345
    using Form-Based authentication. To access the page the user must
346
    have role of either "tomcat" or "role1". By default no user
347
    is configured to have these roles.</td>
348
</tr>
349
 
350
</table>
351
</body>
352
</html>