Creating Directories

First, you must create the following directory in your homedirectory
~/javaserver
Then, in that directory you must create the directory
WEB-INF
Then, in that directory you must create the two directories
classes and src.
You must also create a file called web.xml in the same directory.

The premissions for these files must be as follows:

homedir    drwxr-xr-x 
javaserver drwxr-xr-x
WEB-INF    drwxr-xr-x
classes    drwxr-xr-x
src        drwx------    
web.xml    -rw-r--r--

The .class files from the servlets you write should be
placed in the directoy classes.  The source code can also
be placed here, but it will be ignored. The source code
is supposed to be placed in the directory src, but this is
not required.
Any and all classes you use must be placed in the classes directory
or in subdirectories of it.
The permissions of such executables or subdirectories should be -rwxr-xr-x 


The file web.xml is essentially a mapping of the url names you give to servlets
and the real names of the .class files.  Tomcat will read this file
to know what .class file to execute for a given url request.

Here is a sample web.xml file:
<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Nachum Examples</display-name> <description>Simple example</description> <servlet> <servlet-name>MyHelloWorld</servlet-name> <servlet-class>HelloWorld</servlet-class> </servlet> <servlet-mapping> <servlet-name>MyHelloWorld</servlet-name> <url-pattern>/hello_world</url-pattern> </servlet-mapping> </web-app>
/hello_world is the url for the page. HelloWorld is the name of the .class
file which is placed in the directory classes.
MyHelloWorld is simply the internal web.xml name used to link these two 
elements.

Your servlet can be view at this url:
http://studXX.ise.jct.ac.il:8080/iseproject/hello_world

Replace the XX with your personal number.
Good Luck!



© Nachum Danzig 2004