HomeApache Geronimo v1.0 > Documentation > Apache Geronimo v1.0 - Developer's Guide > Application frameworks > Struts


The core of the Struts framework is a flexible control layer based on standard technologies like Java Servlets, JavaBeans, ResourceBundles, and XML, as well as various Jakarta Commons packages. Struts encourages application architectures based on the Model 2 approach, a variation of the classic Model-View-Controller (MVC) design paradigm. Refer to http://jakarta.apache.org/struts/ for additional details.

Prerequisites

The following software should be installed and configured in order to run the sample covered in this article.

J2SE 1.4.2

Geronimo is currently using the Sun ORB for RMI so it is required to use SUN JDK. These sample applications require as a minimum JDK 1.3. Refer to the following URL for details on how to download and install J2SE 1.4.2:
http://java.sun.com

Apache Ant 1.5

Apache Ant 1.5 or later is required for building the sample application. Ant can be downloaded from the following URL:
http://ant.apache.org

Struts 1.2.9

Although not required for this particular sample, if you are building your own Struts application you can get Struts 1.2.9 from the following URL:
http://struts.apache.org/

Apache Geronimo v1.0

All the sample applications covered in this article will be deployed to Apache Geronimo v1.0.
http://geronimo.apache.org/

Back to Top

Sample application

In this article we will be exploring Geronimo's Struts support by configuring and deploying the JPetStore 5.0 sample application. JPetStore is a Struts-managed middle tier with iBATIS Database Layer as data access strategy. JPetStore uses the same data model and demo contents as the original, well known, JPetStore; see http://ibatis.apache.org/javadownloads.html for additional details.

Back to Top

Configuring the sample application

For this example we will be using the sample's default HSQL database, Apache Geronimo already provides support for this database. The following section describes the steps for defining an HSQL connection pool.

Create a database pool

To create a database in Geronimo follow these steps.

  • Ensure Apache Geronimo is up and running. If it is not running start it by typing the following command:
    <geronimo_home>\bin\geronimo run
  • Access the Geronimo Administration Console by pointing a Web browser to the following URL:
    http://localhost:8080/console
  • Enter system as the user name and manager as the password.
  • From the Geronimo Administration Console click on Database Pools in the Console Navigation menu on the left hand side.
  • Use the wizard to create a new connection pool by clicking on Using the Geronimo database pool wizard.
  • Enter jdbc/jpetstore1 in the Name of Database Pool:.
  • Select HSQLDB Embedded from the Database Type: pull-down menu and click Next.
  • Click on Download a Driver, leave the default HSQLDB 1.7.3 and click Next.
  • Back in the Create Database Pool portlet enter sa as the user name and leave it blank in the password.
  • Enter jpetstore as the database name and click Next.
  • Click on Skip Test and Deploy.

At this point you have created a database connection pool to the Geronimo's embedded HSQLDB database.

Back to Top

Deploy the sample application

In an attempt to demostrate Struts integration with Apache Geronimo we will skip the "build" part for this particular example and we will go stright ahead and deploy the pre-built war. You would normally have to compile the sample application before deployment to include any additional configurations that might be required by the server or the environment in general.

To deploy the sample application run the following command:
<geronimo_home>/bin/deploy --user system --password manager deploy <JPetStore_home>/build/wars/jpetstore.war

Depending on the operating system you are using you should see a message similar to this one:

E:\geronimo\bin>deploy --user system --password manager deploy \apps\JPetStore-5.0\build\wars\jpetstore.war
    Deployed jpetstore @ http://hcunico:8080/jpetstore
    

Note that for deploying this sample application we have not added any Geronimo specific deployment plans, we just configured a database connection pool.

To test the applicaiton open a web browser and access the following URL:
http://localhost:8080/jpetstore

Click on Enter the Store, browse the catalog and place an order.

Back to Top