Creating a Web Application with Ant and Tomcat 4

Creating a Web Application with Ant and Tomcat 4

Tomcat Administration

To login to Tomcat's Web-based administration, point your browser at http://localhost:8080/admin. You will be presented with a login screen. Enter your Tomcat "admin" username and password. These are the same as the "manager" username and password: tomcatusername and tomcatpassword. The tomcat-users.xml file has been set up with a single account with admin, manager, and provider roles. It is a trivial change to set up multiple Tomcat accounts each with separate roles.

The resulting Web page is split into three panels: a heading panel, a tree panel, and a data panel. You can see this sequence of Web pages in Figure 7.

Figure 7

The tree can be used in the normal way -- branches can be opened, selected, etc. Open the Service (Tomcat-Standalone) branch, then the Host (localhost) branch, then the Context (/AddressBook) branch, and finally AddressBook's Resources branch.

Note the global Resources branch further down the tree panel. Do not mix up the global Resources branch with AddressBook's Resources branch. You may define global javax.sql.DataSource resources that can be used by any Web application in the global Resources branch.

AddressBook's Context Panel

Select the Context (/AddressBook) branch. AddressBook's context panel will appear in the data panel. You can see AddressBook's Context Web page in Figure 8.

Figure 8

You may make any changes you wish -- most interestingly, the three different Debug Level parameters. To save the changes, press the Save button, then press the Commit Changes button in the heading panel.

AddressBook's Data Source Panel

Select the Data Sources branch in the Context (/AddressBook)'s Resources branch of the tree. AddressBook's data sources panel will appear in the data panel.

Select the data source jdbc/Public to view that specific javax.sql.DataSource. You can see AddressBook's Data Source Web page in Figure 9.

Figure 9

You may make any changes you wish -- most interestingly, the Data Source URL, JDBC Driver Class, User Name, Password, Max. Active Connections, Max. Idle Connections, and Max. Wait for Connection. To save the changes, press the Save button, then press the Commit Changes button in the heading panel.

If you are simply working on your personal computer, this may not seem to be very important, but on your company's production Web server environment, this is a really important facility. These parameters are likely to change, and you don't need to be a programmer to change them -- a Tomcat administrator can do it. As a programmer, my head is already full of usernames and passwords, and I don't want to know any more. I certainly do not want to know my company's production database username and password. Quite rightfully, too -- such information should be on a need-to-know basis, and, because of javax.sql.DataSources, and Tomcat 4's administration service, I no longer need to know.

Using Ant to establish a Web application's context is fine when developing the software. Tomcat's administration service comes into its own in the production environment.

AddressBook's Logger Panel

Select the Logger for Context (/AddressBook) branch in the Context (/AddressBook) branch of the tree. AddressBook's logger panel will appear in the data panel. You can see AddressBook's Logger Web page in Figure 10.

Figure 10

You may make any changes you wish -- the most interesting options are Debug Level and Verbosity Level. To save the changes, press the Save button, then press the Commit Changes button in the heading panel.

Biblography

This article could not have been written without the assistance of these documents:

Tomcat Servlet/JSP Container Documentation
You can get the latest Tomcat, which includes documentation, from http://jakarta.apache.org/tomcat.

Java Web Services Developers Pack Tutorial
You can get the latest Java Web Services Developers Pack Tutorial from java.sun.com/webservices/tutorial.html.

Paul Wood has been programming for 32 years and is now a freelancer.


Return to ONJava.com.

Prev  [1] [2] [3] [4] 

Close    To Top
  • Prev Article-Java:
  • Next Article-Java:
  • Now: Tutorial for Web and Software Design > Java > Java Servlets > Java Content
    Photoshop Tutorial
     

    Special Effect

      3D Effect
      Photoshop Articles
    Programming Tutorial
     

    C/C++ Tutorial

      Visual Basic
      C# Tutorial
    Database Tutorial
     

    MySQL Tutorial

      MS SQL Tutorial
      Oracle Tutorial
    Geek Tutorial
     

    Blogging Tutorial

      RSS Tutorial
      Podcasting Tutorial
    Graphic Design Tutorial
      Coreldraw Tutorial
      Illustrator Tutorial
      3D Tutorials
    Webmaster Articles
     

    Domain Service

      Web Hosting
      Site Promotion
    Java Tutorial/ Articles
     

    Java Servlets

      JavaEE Tutorial
     

    JavaBeans Tutorial

    XML Tutorial/ Articles
     

    XML Style

      AJAX Tutorial
      XML Mobile
    Flash Tutorial/ Articles
     

    Flash Video

      Action Script
      Flash Articles
    OS Tutorial/ Articles
      Linux Tutorial
      Symbian Tutorial
      MacOS Tutorial
    Personal Tech
      Hardware Tutorial
      Software Tutorial
      Online Auction