Building a Struts2 Application
- Create new maven maven-archetype-webapp project with the name strutsapp.
- Rename the JavaR esources/src/main/resources directory to Java Resources/src/main/java
- Replace the web.xml file with this one.
- Replace the pom.xml file with this one. In your project's
file org.eclipse.wst.common.project.facet.core.xml make sure facet="jst.web" version="2.4. Then
run maven update command. This should clear any project errors.
- In Java Resources/src/main/java create a file named struts.xml and then replace it with
this one.
- In Java Resources/src/main/java create a file named log4j2.xml and then replace it with
one. Make sure to update the file path in the file to your own user direction
- In Deployed Resources/webapp/web-inf create the directory jsp/welcome
- In Deployed Resources/webapp/web-inf/jsp/welcome directory create two files named hello.jsp and default-action.jsp and replace
hello.jsp with this one and default-action.jsp with this one.
- In Deployed Resources/webapp directory create the file named index.jsp and replace
index.jsp with this one.
- Run the command http://localhost:8080/strutsapp and you should see Hello World which is the index.jsp file
- Run the command http://localhost:8080/strutsapp/default-action and you should see default-action.jsp for COMP 3601 which is the default-action.jsp file
- Run the command http://localhost:8080/strutsapp/hello and you should see Hello.jsp for COMP 3601 which is the hello.jsp file
- Make sure you understand how everything connects and explain to me in order to get your mark.