Tomcat Direct Programming

Programming a Web Application - The Direct Approach

It is possible to create a Web application without using any external tool, except for a text editor (e.g. Emacs) and a Java compiler (e.g. javac).

To create a Web application, follow these instructions:

To access your application, you will have to restart Tomcat. You will also have to restart Tomcat to reflect changes you make in your Java class files and in the file WEB-INF/web.xml.

An Example

In the following example, we create a Web application named dbinfo. This application shows a user a list of her tables in her Oracle database (used by our course). For this application, we use a Web page and a Servlet (click to view ShowTables.java, tables.html and web.xml).

The following image shows the commands executed from the Unix shell in our school. We use Emacs to edit our files.

shell commands

After (re)starting Tomcat, the application is accessible using Mozilla:

tables.html

ShowTables

Notes