Submit a Ticket
Support Center » Knowledgebase » JSP - Tomcat » JSP hosting: Servlet Samples

JSP hosting: Servlet Samples

JSP Hosting: Servlet Examples with Code

This is a collection of examples which demonstrate some of the more frequently used parts of the Servlet API. Familiarity with the Java(tm) Programming Language is assumed.

These examples will only work when viewed via an http URL. They will not work if you are viewing these pages via a "file://..." URL.

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.

Tip: To see the cookie interactions with your browser, try turning on the "notify when setting a cookie" option in your browser preferences. This will let you see when a session is created and give some feedback when looking at the cookie demo.
 
Hello WorldExecuteSource
Request InfoExecuteSource
Request HeadersExecuteSource
Request ParametersExecuteSource
CookiesExecuteSource
SessionsExecuteSource

Note: The source code for these examples does not contain all of the source code that is actually in the example, only the important sections of code. Code not important to understand the example has been removed for clarity.

 This answer was helpful  This answer was not helpful
 Back