This collection of examples demonstrates some of the more frequently used parts of the Servlet API. Familiarity with the Java(tm) Programming Language is assumed.
These examples only work when you view the pages with an http URL. They do not work if you view these pages using a file://... URL. Please refer to the README file provide with this Tomcat release regarding how to configure and start the provided web server.
Wherever you see a form, enter some data and see how the servlet reacts. When playing with the Cookie and Session Examples, jump back to the Headers Example to see exactly what your browser is sending the server.
To navigate your way through the examples, the following icons provide help:
![]() |
Execute the example |
| Look at the source code for the example | |
| Return to this screen |
Tip - To see the cookie interactions with your browser, try turning
on the Notify When Setting a Cookie option in your browser preferences. This
lets you see when a session is created and provides feedback when looking at
the cookie demo.
| Hello World | Execute |
|
| Request Info | Execute |
|
| Request Headers | Execute |
|
| Request Parameters | Execute |
|
| Cookies | Execute |
|
| Sessions | Execute |
Note - The source code for these examples does not contain all of the source code that is actually in the example. It contains only the important sections of code. Code not needed to understand the example has been removed for clarity.