Java Reference
In-Depth Information
This entry tells the servlet containers that we have a new Web application and it is located in
the <SERVER_ROOT>/djs/ directory with a document base of webapps/djs/ .
You should also change the port Tomcat is listening to for HTTP requests. You do this by
changing the port value to 80 in the following entry of the same
<SERVER_ROOT>/conf/server.xml file:
<Connector className=”org.apache.tomcat.service.SimpleTcpConnector”>
<Parameter name=”handler”
<Parameter name=”port” value=”80”/>
Now we need to add the application's directories as follows:
Building and Installing the BasicServlet
To test your newly created Web application we will build and install the BasicServlet from
Chapter 3, “Servlet Basics.” You need to complete two steps to run your newly created servlet.
The first step is to compile the servlet code. The second is to install the servlet into your Web
To compile the servlet, make sure the servlet SDK is on your CLASSPATH . You can find the
JSDK classes in the C:\jakarta-tomcat\lib\servlet.jar file.
After the servlet has been compiled, you need to copy the class file to the appropriate directory
in the Web application and restart the Tomcat server. This directory should be the following for
These directories should be used throughout the topic. Now open your browser to the follow-
ing URL:
You should not be required to restart the Tomcat server with the change or addition
of a servlet, but if your changes are not reflected when you reload your servlet, go
ahead and stop and restart the server.
Search WWH ::

Custom Search