Struts 2 Getting-Started with Hello-World Example on GNU/Linux

May 9, 2017 | By the+gnu+linux+evangelist | Filed in: Tutorial.

Getting-Started with Struts 2 on Linux

You are Welcome! The Tutorial Shows You Step-by-Step How to Quick Start with a Struts 2 Hello-World Java Web Application on GNU/Linux Systems.

The first Benefit of Using Struts is that you don’t have to write a Controller and can concentrate on writing Business Logic in action classes.

The Tutorial make Use of the Maven Java Tool Facility to Getting-Started Easy with a Basic Struts2 Web App on Linux.

Struts 2 can Use either an XML Configuration file or Java Annotations (or both) to specify the relationship between a URL, a Java class, and a view page (such as index.jsp).

Struts 2 Quick Start on Linux - Featured
  1. How to Install Struts 2 on GNU/Linux

    Struts 2 Linux Installation
  2. Check if Maven 3+ is Setup on Linux

    mvn -v

    How to Install the Latest Apache Maven on Linux

  3. Generate a Maven Standard Java Web App Project:

    Maven Create Web App Project
  4. Edit the pom.xml Config File

    cd myWebApp
    nano pom.xml

    Modify the “build” Entry like:


    Ctrl+x to Save & Exit from nano :)

  5. Add Struts 2 Jar Files To Class Path

    nano ./pom.xml

    Include in the “dependencies” Section:


    Just Subsitute to X.X.X., the Suited Struts 2 Version (May simply Look the Latest Downloaded Struts Release!)

  6. Building and Packaging to Easy Deploy on the Servlet Container

    mvn clean package

    Find the Artifact Product Ready to Deploy on:

  7. How to Deploy a Servelet on Apache Tomcat Container

    Tomcat Easy Deploying Guide
  8. Then You can Browse the Struts2 StartUp Hello-World

  9. Add Logging

    This to see what’s happening under the hood…

    nano ./pom.xml

    Include in the “dependencies” Section:


    Then Create a Log4J Config File

    nano ./src/main/resources/log4j.xml


  10. Add a Struts 2 Servlet Filter

    nano ./src/main/webapp/WEB-INF/web.xml


  11. Struts 2 App Minimal XML Configuration

    nano ./src/main/resources/struts.xml


  12. Building and Packaging Again

    mvn clean package
  13. Deploy and Access the Final Struts2 Hello-World App


Tags: , , , , , , , , , , , , , ,

QuickChic Theme • Powered by WordPress