$schemamarkup = get_post_meta(get_the_ID(), 'schemamarkup', true); if(!empty($schemamarkup)) { echo $schemamarkup; }

Struts 2 Getting Started With Hello-World Example on Gnu/Linux

May 9, 2017 | By the+gnu+linux+evangelist.

Getting-Started with Struts 2 on Linux

Hi! 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

    Here Struts 2 Linux Installation
    How to Install Struts 2 Java Framework on GNU/Linux
  2. Check if Maven 3+ is Setup on Linux

    Copy
    mvn -v

    How to Install the Latest Apache Maven on Linux

  3. Generate a Maven Standard Java Web App Project:

    Here Maven Create Web App Project
    Links to Guide on Making a Maven Web Applications Project on Linux
  4. Edit the pom.xml Config File

    Copy
    cd myWebApp
    Copy
    nano pom.xml

    Modify the “build” Entry like:

    Copy
    <build>
    <finalName>basic_struts</finalName>
    </build>
    

    Ctrl+x to Save & Exit from nano :)

  5. Add Struts 2 Jar Files To Class Path.

    Copy
    nano ./pom.xml

    Include in the “dependencies” Section:

    Copy
    <dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts2-core</artifactId>
    <version>[X.X.X.X]</version>
    </dependency>
    

    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.

    Copy
    mvn clean package

    Find the Artifact Product Ready to Deploy on:

    Copy
    ./target/basic_struts.war
  7. How to Deploy a Servelet on Apache Tomcat Container

    Here Tomcat Easy Deploying Guide
    How to Easy Deploying Servlets on Apache Tomcat Server
  8. Then you can Browse the Struts2 StartUp Hello-World.

    Copy
    http://localhost:8080/basic_struts/
  9. Add Logging.

    This to see what’s happening under the hood…

    Copy
    nano ./pom.xml

    Include in the “dependencies” Section:

    Copy
    <dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.14</version>
    </dependency>
    

    Then Create a Log4J Config File

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

    Append:

    Copy
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
     
    
  10. Add a Struts 2 Servlet Filter.

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

    Insert:

    Copy
    
    struts2
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    
    
    struts2
    /*
    
    
  11. Struts 2 App Minimal XML Configuration.

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

    Append:

    Copy
    
    
    
    
    
    
    /index.jsp
    
    
    
    
  12. Building and Packaging Again.

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

    Copy
    http://localhost:8080/basic_struts/