Getting started with Java servlets

    To get Java servlets up and running requires more than knowledge about Java in general or servlets in particular: one needs to know about servers, servlet containers, and XML.  To get started, it is useful to have some "cookbook" instructions, however published books shy away from such instructions, in part because the technical details keep changing.  A Web-based guide can be more current: this document is meant to get you started using the book "Java Servlet Programming".  This guide takes a lowest-common-denominator platform using recent versions of free servlet-related software that you can run on your local computer as well as a low cost reliable Web-hosting arrangement for running your servlets from the Web.

Preparing the environment on your local computer


Setting up Tomcat on your local computer for easy use:


Running a simple servlet


Running a servlet needing a web.xml file

    Servlets often use "Deployment Descriptors" in a "web.xml" file found in the folder containing the "classes" folder.  If you have never dealt with servlets or xml before these will be unfamiliar files containing instructions that will determine whether or not your servlets work properly.  For this reason you need to work with these files even if you don't understand them yet.  Here is how to get going:


Running a servlet using commercial hosting

Lunarpages.com offers domain hosting for $96 per year, and for an additional $24 per year you can specify Java servlet support.  The servlet container is Resin.  Follow these directions to get your servlets running on the Web:


If you have any comments about this page please contact Mickey Segal.