This project is a basic example of a dynamic web application "Hello World! through the Struts2 action". The project was created using the Eclipse for EE IDE and Maven.
Before executing the project you should have downloaded and installed the following elements:
- Java JDK
- Apache Maven
- Eclipse IDE (you can use other IDEs, but the configuration may be different)
Note that some versions of the above tools may be incompatible with each other, so make sure to install versions that are compatible with each other.
Follow the next steps to clone and execute the project.
For this step you need to have installed the Git tool.
Now you need to initialize your local repo, so open a bash in the folder you are going to store the project and type the following commands:
git init
(Initializes the repo)
git clone https://github.com/MavapeGZ/HelloWorld-struts2.git
(Clones the repo)
If you are not yet in the directory where you cloned the repo, move there:
cd HelloWorld-struts2
We need to compile the project in order to be able to run it later.
mvn clean install
If some errors are appearing in your bash, check the error and fix it.
mvn jetty:run
If you followed the steps and no errors showed on the screen, congratulations, you did it!
Now, you should open your favourite browser and tipe the following URL:
http://localhost:8080/HelloWorld-struts2/
This is a connection on to your own machine in the 8080 port (the default one). If some error is on the screen, maybe you have this port not available.
The HelloWorldAction.java class handles the HTTP request and delegates the response to the view (JSP).
The HelloWorld.jsp file shows the stored message in the MessageStore class.
- struts.xml contains the Struts2 configuration for actions and views.
- web.xml contains the configuration of the servlet for Struts2 in the deployment descriptor.
This project is under MIT License. Check the LICENSE file for more details.