Web Application Development: Generating Struts Artifacts

This document describes the following:


1. Generating Struts Artifacts

You can use OEPE to automatically generate various Struts artifacts for your dynamic Web project. To do so, perform the following steps:

1.1 Configuring a Project for Struts

To configure your dynamic Web project for Struts, follow this procedure:
  1. Either add the Struts facet when you create the project, or add the facet to an existing project by right-clicking your project in the Project Explorer and selecting Properties from the drop-down menu. This will open the Properties dialog, as Figure 1 shows.



    Figure 1.
    Project Properties Dialog



  2. In the Properties dialog, select Project Facets on the left panel, and then select Struts from the Project Facet list. Note that the Struts facet requires dynamic Web module version 2.3 or later.

    To configure your project to use Struts 1.3 library, select the Struts 1.3 facet, and then click Further configuration required... link. This will open the Modify Faceted Project > Struts dialog, as Figure 2 shows. If Struts 1.3 is not listed, then click Download Library icon to indicate your intention to obtain the library. This will open the Download Library dialog, as Figure 3 shows.



    Figure 2.
    Modify Faceted Project - Struts Dialog





    Figure 3.
    Downloading Library


    Note that you can either add the library from the local installation, or you can select a shared library provided by Oracle WebLogic Server (if this option is supported).

    Select Struts 1.3 library and the destination folder, and then click Next. Note that if you select a library other than Struts, or a mismatch between a Struts facet version and library version is detected, a notification message will be displayed alerting you of the error.

    On the next screen, accept the term of the Apache license, and click Finish to trigger the download. Figure 4 shows Modify Faceted Project > Struts dialog after the Struts library has been downloaded.



    Figure 4.
    Modify Faceted Project - Struts Dialog



  3. Click OK on the Modify Faceted Project > Struts Facet dialog.

  4. By clicking Apply > OK on the Properties dialog, you will complete the configuration of the Struts library for your project, as Figure 5 shows.



    Figure 5.
    Struts Library in Project View



1.2 Generating Struts Files and Updating the Configuration

When added to your dynamic Web project, the Struts facet automatically generates the following artifacts and performes the following configurations:
  • Configures the web.xml file, as follows:
    • Adds an action servlet in a form of the org.apache.struts.action.ActionServlet.
    • Adds a servlet-mapping (using the URL *.do pattern).
    • Adds a config parameter for struts-config.xml.



  • Adds Struts-specific configuration files, such as struts-config.xml and others, in your project's WEB-INF/config directory.

  • Adds JSP template files and resource bundles containing the sample Struts code that you can deploy out of the box.


1.3 Supported Versions

OEPE provides support for various Oracle WebLogic Server versions, as well as the following Apache Struts versions:
  • 1.3
  • 1.2
  • 1.1

The following table maps supported versions of Struts libraries and Oracle WebLogic Server shared libraries:


Struts Library Oracle WebLogic Server Shared Library Downloadable Library User Library
Struts 1.3 Not supported Supported Supported
Struts 1.2 Oracle WebLogic Server versions 10.0 and 9.2 are supported Supported Supported
Struts 1.1 Oracle WebLogic Server versions 10.0 and 9.2 are supported Supported Supported




2. Related Information

The Apache Struts Web Site

Dynamic Web Projects