|
Running ServletsDifferent releases of the Java Servlet Development Kit have included different utilities for testing and running servlets. The way to use these utilities to run the HelloWorldServlet is described below. Please ensure that you set up the relevant servlet packages before attempting this. Instructions for students in SOCS are here. JSDK 2.0 : The Servlet RunnerThe servletrunner is a cut down webserver that can be easily run from the command line and allows the user to test servlets and view any debugging output/error messages that may be generated. The servletrunner is very easy to use, but it is also very limited because it can only serve servlets. Html pages and other content cannot be served by this utility, which makes it quite difficult to use to test more complex applications. In order to run the HelloWorldServlet try typing something like this at the command line :- servletrunner -d /path/to/servlet/dir Note : I have found that the servletrunner needs an absolute path specified, it tends to get confused by relative paths. Once the servletrunner has started, you should be able to access the HelloWorldServlet by using the following address in your web-browser : or http://machinename:8080/servlet/HelloWorldServlet (if you are on a networked system) Unless your feeling particularly masochistic, use the JSDK 2.1 server below. JSDK 2.1 : The JSDK Server (Reccomended)This is much improved version of the servletrunner which can serve both servlets and other content, such as html pages. It is however, a little more difficult to use and requires a small amount of set up work to be done before it can be used. If you follow the steps listed below everything should work ! :
Proxy ServersIf you have your browser setup to use a proxy, you need to ensure that the proxy is bypassed to use 'localhost'. If accessing using a local machine name, you should bypass this address too, or you may have problems with the proxy caching old versions of the page.
| |||||
|
Tims Home Page | Page last modified : 19 May 2003 | ||||||