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>Servlet 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>Servlet |
||
| 29 | Examples with Code</h1> |
||
| 30 | <p>This is a collection of examples which demonstrate some of the more |
||
| 31 | frequently used parts of the Servlet API. Familiarity with the Java(tm) |
||
| 32 | Programming Language is assumed. |
||
| 33 | <p>These examples will only work when viewed via an http URL. They will |
||
| 34 | not work if you are viewing these pages via a "file://..." URL. Please |
||
| 35 | refer to the <i>README</i> file provide with this Tomcat release regarding |
||
| 36 | how to configure and start the provided web server. |
||
| 37 | <p>Wherever you see a form, enter some data and see how the servlet reacts. |
||
| 38 | When playing with the Cookie and Session Examples, jump back to the Headers |
||
| 39 | Example to see exactly what your browser is sending the server. |
||
| 40 | <p>To navigate your way through the examples, the following icons will |
||
| 41 | help:</p> |
||
| 42 | <ul style="list-style-type: none; padding-left: 0;"> |
||
| 43 | <li><img src="images/execute.gif" alt=""> Execute the example</li> |
||
| 44 | <li><img src="images/code.gif" alt=""> Look at the source code for the example</li> |
||
| 45 | <li><img src="images/return.gif" alt=""> Return to this screen</li> |
||
| 46 | </ul> |
||
| 47 | |||
| 48 | <p>Tip: To see the cookie interactions with your browser, try turning on |
||
| 49 | the "notify when setting a cookie" option in your browser preferences. |
||
| 50 | This will let you see when a session is created and give some feedback |
||
| 51 | when looking at the cookie demo.</p> |
||
| 52 | <table style="width: 85%;" > |
||
| 53 | <tr> |
||
| 54 | <td>Hello World</td> |
||
| 55 | |||
| 56 | <td style="width: 30%;"><a href="servlet/HelloWorldExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/HelloWorldExample">Execute</a></td> |
||
| 57 | |||
| 58 | <td style="width: 30%;"><a href="helloworld.html"><img SRC="images/code.gif" alt=""></a><a href="helloworld.html">Source</a></td> |
||
| 59 | </tr> |
||
| 60 | |||
| 61 | <tr> |
||
| 62 | <td>Request Info</td> |
||
| 63 | |||
| 64 | <td style="width: 30%;"><a href="servlet/RequestInfoExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/RequestInfoExample">Execute</a></td> |
||
| 65 | |||
| 66 | <td style="width: 30%;"><a href="reqinfo.html"><img SRC="images/code.gif" alt=""></a><a href="reqinfo.html">Source</a></td> |
||
| 67 | </tr> |
||
| 68 | |||
| 69 | <tr> |
||
| 70 | <td>Request Headers</td> |
||
| 71 | |||
| 72 | <td style="width: 30%;"><a href="servlet/RequestHeaderExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/RequestHeaderExample">Execute</a></td> |
||
| 73 | |||
| 74 | <td style="width: 30%;"><a href="reqheaders.html"><img SRC="images/code.gif" alt=""></a><a href="reqheaders.html">Source</a></td> |
||
| 75 | </tr> |
||
| 76 | |||
| 77 | <tr> |
||
| 78 | <td>Request Parameters</td> |
||
| 79 | |||
| 80 | <td style="width: 30%;"><a href="servlet/RequestParamExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/RequestParamExample">Execute</a></td> |
||
| 81 | |||
| 82 | <td style="width: 30%;"><a href="reqparams.html"><img SRC="images/code.gif" alt=""></a><a href="reqparams.html">Source</a></td> |
||
| 83 | </tr> |
||
| 84 | |||
| 85 | <tr> |
||
| 86 | <td>Cookies</td> |
||
| 87 | |||
| 88 | <td style="width: 30%;"><a href="servlet/CookieExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/CookieExample">Execute</a></td> |
||
| 89 | |||
| 90 | <td style="width: 30%;"><a href="cookies.html"><img SRC="images/code.gif" alt=""></a><a href="cookies.html">Source</a></td> |
||
| 91 | </tr> |
||
| 92 | |||
| 93 | <tr> |
||
| 94 | <td>Sessions</td> |
||
| 95 | |||
| 96 | <td style="width: 30%;"><a href="servlet/SessionExample"><img SRC="images/execute.gif" alt=""></a><a href="servlet/SessionExample">Execute</a></td> |
||
| 97 | |||
| 98 | <td style="width: 30%;"><a href="sessions.html"><img SRC="images/code.gif" alt=""></a><a href="sessions.html">Source</a></td> |
||
| 99 | </tr> |
||
| 100 | </table> |
||
| 101 | |||
| 102 | <p>Note: The source code for these examples does not contain all of the |
||
| 103 | source code that is actually in the example, only the important sections |
||
| 104 | of code. Code not important to understand the example has been removed |
||
| 105 | for clarity.</p> |
||
| 106 | |||
| 107 | <h2>Other Examples</h2> |
||
| 108 | <table style="width: 85%;" > |
||
| 109 | |||
| 110 | <tr> |
||
| 111 | <th colspan="3">Servlet 3.0 Asynchronous processing examples:</th> |
||
| 112 | </tr> |
||
| 113 | <tr> |
||
| 114 | <td>async0</td> |
||
| 115 | <td style="width: 30%;"> |
||
| 116 | <a href="../async/async0"><img SRC="images/execute.gif" alt=""> Execute</a> |
||
| 117 | </td> |
||
| 118 | <td style="width: 30%;"></td> |
||
| 119 | </tr> |
||
| 120 | <tr> |
||
| 121 | <td>async1</td> |
||
| 122 | <td style="width: 30%;"> |
||
| 123 | <a href="../async/async1"><img SRC="images/execute.gif" alt=""> Execute</a> |
||
| 124 | </td> |
||
| 125 | <td style="width: 30%;"></td> |
||
| 126 | </tr> |
||
| 127 | <tr> |
||
| 128 | <td>async2</td> |
||
| 129 | <td style="width: 30%;"> |
||
| 130 | <a href="../async/async2"><img SRC="images/execute.gif" alt=""> Execute</a> |
||
| 131 | </td> |
||
| 132 | <td style="width: 30%;"></td> |
||
| 133 | </tr> |
||
| 134 | <tr> |
||
| 135 | <td>async3</td> |
||
| 136 | <td style="width: 30%;"> |
||
| 137 | <a href="../async/async3"><img SRC="images/execute.gif" alt=""> Execute</a> |
||
| 138 | </td> |
||
| 139 | <td style="width: 30%;"></td> |
||
| 140 | </tr> |
||
| 141 | <tr> |
||
| 142 | <td>stockticker</td> |
||
| 143 | <td style="width: 30%;"> |
||
| 144 | <a href="../async/stockticker"><img SRC="images/execute.gif" alt=""> Execute</a> |
||
| 145 | </td> |
||
| 146 | <td style="width: 30%;"></td> |
||
| 147 | </tr> |
||
| 148 | |||
| 149 | <tr> |
||
| 150 | <th colspan="3">Servlet 3.1 Non-blocking IO examples</th> |
||
| 151 | </tr> |
||
| 152 | <tr> |
||
| 153 | <td>Byte counter</td> |
||
| 154 | <td style="width: 30%;"> |
||
| 155 | <a href="nonblocking/bytecounter.html"><img src="images/execute.gif" alt=""> Execute</a> |
||
| 156 | </td> |
||
| 157 | <td style="width: 30%;"></td> |
||
| 158 | </tr> |
||
| 159 | <tr> |
||
| 160 | <td>Number Writer</td> |
||
| 161 | <td style="width: 30%;"> |
||
| 162 | <a href="nonblocking/numberwriter"><img src="images/execute.gif" alt=""> Execute</a> |
||
| 163 | </td> |
||
| 164 | <td style="width: 30%;"></td> |
||
| 165 | </tr> |
||
| 166 | |||
| 167 | <tr> |
||
| 168 | <th colspan="3">Servlet 4.0 Server Push examples</th> |
||
| 169 | </tr> |
||
| 170 | <tr> |
||
| 171 | <td>Simple image push</td> |
||
| 172 | <td style="width: 30%;"> |
||
| 173 | <a href="serverpush/simpleimage"><img src="images/execute.gif" alt=""> Execute</a> |
||
| 174 | </td> |
||
| 175 | <td style="width: 30%;"></td> |
||
| 176 | </tr> |
||
| 177 | |||
| 178 | <tr> |
||
| 179 | <th colspan="3">Servlet 4.0 Trailer Field examples</th> |
||
| 180 | </tr> |
||
| 181 | <tr> |
||
| 182 | <td>Response trailer fields</td> |
||
| 183 | <td style="width: 30%;"> |
||
| 184 | <a href="trailers/response"><img src="images/execute.gif" alt=""> Execute</a> |
||
| 185 | </td> |
||
| 186 | <td style="width: 30%;"></td> |
||
| 187 | </tr> |
||
| 188 | |||
| 189 | </table> |
||
| 190 | |||
| 191 | </body> |
||
| 192 | </html> |