Edit Edit

Java Servlet FAQ


How do you install a servlet on the JavaServer Web Development Kit(JSWDK)?


1) Copy your servlet's .class or .jar file to the \servlets directory where you installed the JSWDK:

JSWDK\examples\Web-inf\servlets

2) If your servlet requires init parameters, use a text editor to edit the servlet.properties file in the directory:

JSWDK\examples\Web-inf

Add the following lines to your servlet.properties file:

myregisteredservletname.code=MyServlet
myregisteredservletname.initparams=initarg1=value1,initarg2=value2

where MyServlet is your servlet .class file's base name, initarg1 is the name of the first init parameter and value 1 is the value of the first init parameter, etc.

3) Restart the web server by running the startserver.bat file in your JSWDK directory

4) Invoke the servlet by running your Web browser and typing the URL in the following format:

http://<hostname>:8080/examples/servlet/<servletname>

For example, if your web server is running on your local machine, use

http://localhost:8080/examples/servlet/MyServlet

or if you registered your servlet in the servlet.properties file, use

http://localhost:8080/examples/servlet/myregisteredservletname



Last updated 12/27/1999 09:01:18 PM