Edit Edit

Java Servlet FAQ

How do you invoke a servlet from your Web browser?

1) Servlets can be explicitly accessed with the URL:


where server is the name of the server or localhost if the server is running on your local machine and ServletName is the name of your servlet class name.

2) Run the web server administration tool and associate an arbitrarily chosen name with the servlet class name. This name is sometimes called the "registered" servlet name. For example, you could associate "MyName" with your servlet class name and you would invoke the servlet with the URL:


3) Run the web server administration tool and set up an alias for a URL so that when that when that URL is accessed, a specific servlet is invoked. For example, you can alias the following URL to invoke a servlet:


Aliases are useful if you’re replacing existing HTML pages with servlets. You can keep the URLs the same; they’ll invoke servlets instead of displaying the HTML.

Last updated 12/26/1999 12:56:52 PM