The Servlet Extension
This extension is primarily about writing a Java Servlet. The extension
is primarily for students who has followed the course Web Programming
or has basic skills in html.
A Java Servlet is a program, which is run on a server for homepages.
The main idea is, that when a browser asks for a given homepage, the server of
the homepage calls the servlet. The servlet then creates a homepage, which is
returned to the browser.
The following links contains usefull informations about servlets:
of the use of servlets (text is in danish, but still usefull for english students).
- API reference
for Java Servlets
You can be inspired by the way google works when creating
Servlets at it-c
If you want to use servlets at IT-C you must use a Tomcat server. The sysadm has written a paper
on how this is done, which can be downloaded here
(it is in danish). You will have to use a machine running linux.
The paper contains no information on, how a homepage calling a servlet is made. This is descriped in the
API reference. With the Tomcat server at IT-C you can do it in the following steps:
- Create your servlet (for instance Helloworld.java) which you want to call from a homepage.
- Compile the servlet as described in the note about Tomcat.
- Start Tomcat at the machine.
- Create the homepage to call your servlet (for instance Helloworld.html). In the FORM-field
you must reference your servlet, for example http://localhost:8080/user/beetle/servlet/Helloworld if
your login is beetle.
- Place Helloworld.html in your public_html folder.
- You can now run your servlet from http://localhost:8080/www.it-c.dk/~beetle/Helloworld.html
For instance the following homepage
AdditionForm.html references a servlet AdditionServlet.java, which is run by