I have a problem at this example
I work with eclipse for Java EE and Apache Tomcat 8. My project structure:
The web.xml code:
First of all the project is created by using Maven configuration, and to access the Struts action you should use url
Step 6 - Build the WAR File and Run The Application
Execute
mvn clean
package to create the war file.Copy the war file to your Servlet container. After your Servlet container successfully deploys the war file go to this URL
http://localhost:8080/helloworld/index.action
where you should see the following:
(source: apache.org)
Web application context is where the application was deployed. In the docs url it's /helloworld
, on the image it's /Hello_World_Struts2_Ant
. Use it as a part of the url. It doesn't matter which app context did you use during deployment but url depends on it. If you want to change the web app context you should read Java - How to change context root of a dynamic web project in Eclipse. After the context you use action name with .action
extension to execute action.
Don't use URLs like localhost:8080/helloworld/index.jsp
because you might not get the resource because it's already handled by the web server.