Java Servlets on bama

Please note: In order to set up Java Servlets, you should have an interactive shell on your bama account. More information is available.

Tomcat 3.2.1 is installed on bama; it works with our Apache Web server to allow both Java Servlets and JavaServer Pages (.jsp). Tomcat 3.2.1 conforms to the Java Servlet 2.2 specification. More information on Java and the servlet specification can be found at java.sun.com.

If you would like to run Java Servlets or JavaServer Pages, you must come to the HelpDesk and sign a statement of responsibility. Your account name will be added to the list of users who are allowed to use Servlets; this process may take up to 24 hours.

Once your account is enabled for Servlets, you will find that a new subdirectory named "java" has been added to your bama account. It is the root directory of your Web (servlet) application directory structure. You will put the various pieces of your Java application in this subdirectory. The following describes the directory structure:

your_homedir/java/

Simple HTML is placed here. Examples are "index.html" and any subdirectories with other Web content. Java ServerPages can also go under here. These files can be accessed under http://bama.ua.edu/account/ (where account is your bama account name).

your_homedir/java/images/

Images for Web pages go here.

your_homedir/java/WEB-INF/

This is the root of your Servlet area.

your_homedir/java/WEB-INF/classes/

Java class files (compiled bytecode) go here. These are accessed as http://bama.ua.edu/account/servlet/ServletName (where account is your bama account name and ServletName is your class file name without the ".class" suffix).

your_homedir/java/WEB-INF/lib/

Place jar (class file libraries) here. This is automatically included in your classpath when the servlet runs.

Servlets are automatically reloaded into the Tomcat Servlet engine when you replace the class file. If you use a web.xml file to store properties, these may not get updated in the servlet when web.xml changes. The only way to get the Servlet to read in these changes is to update the Servlet so that the Servlet itself reloads.

For specific examples please see:
http://bama.ua.edu/examples/servlets/
http://bama.ua.edu/examples/jsp/