Struts v2.3.8 Integration

This samples demonstrates Struts 2 Web framework integration through a simple phonebook Web application deployed to Liberty.

The samples uses Struts 2.x as the model-view-control framework for presentation logic and Spring as the IoC container to inject a bean into a Struts 2 action.

This sample can be installed onto runtime versions 8.5.5.0 and later.

Installation Instructions

Online installation (requires 8.5.5.6 or later):

  1. Install the sample by running the command below from the bin directory of your server installation:
    installUtility install Struts2Sample

Any missing features required by the server will be installed for you.

Offline installation:

  1. Download the Struts2Sample.jar using the download button at the top of the page and place it in the root of your server installation.
  2. Extract the sample into the Liberty installation by running the command below from the root of your server installation:
    java -jar Struts2Sample.jar

Any missing features required by the server will need to be installed separately.

Running The Application

  1. Start the Struts2Sample server by running the command 'bin/server run Struts2Sample' from the root of the Liberty profile installation, and confirm the application started by looking in the console output":
    CWWKZ0001I: Application PhoneBookByStruts2 started in XX.XX seconds.
  2. In your browser, enter the URL for the application: http://localhost:9114/PhoneBookByStruts2/ (where port 9114 assumes the httpEndpoint provided in the sample server.xml has not been modified).
  3. In your browser, you should see the phone book displayed.

Notes

This sample does not include the open source dependencies. The installer will provide a list of the open source pre-requisite libraries and where they can be downloaded from. To help obtaining these libraries, the installer provides the option to download them on your behalf.

Sample Structure

  • wlp
    • usr
      • servers
        • Struts2Sample
          • Copyright.txt
          • apps
            • PhoneBookByStruts2-1.0.0.war
          • lafiles
            • LA_en
            • LI_en
          • readme.html
          • server.xml
      • shared
        • config
          • Struts2SampleLibs.xml
        • resources
          • Struts2SampleLibs
            • aopalliance-1.0.jar
            • asm-3.3.jar
            • asm-commons-3.3.jar
            • asm-tree-3.3.jar
            • commons-fileupload-1.2.2.jar
            • commons-io-2.0.1.jar
            • commons-lang3-3.1.jar
            • commons-logging-1.1.1.jar
            • freemarker-2.3.19.jar
            • javassist-3.11.0.GA.jar
            • ognl-3.0.6.jar
            • spring-aop-3.0.5.RELEASE.jar
            • spring-asm-3.0.5.RELEASE.jar
            • spring-beans-3.0.5.RELEASE.jar
            • spring-context-3.0.5.RELEASE.jar
            • spring-core-3.0.5.RELEASE.jar
            • spring-expression-3.0.5.RELEASE.jar
            • spring-web-3.0.5.RELEASE.jar
            • struts2-api-2.0.5.jar
            • struts2-core-2.3.8.jar
            • struts2-spring-plugin-2.3.8.jar
            • xwork-core-2.3.8.jar