i'm learning struts2 framework and i'm trying to make a first exercise (following a guide).
The exercise is a simple Hello World...
When I run on server my application, the page show me the error 404, The requested resource is not available.
I don't know why. I searched other questions about this problem, but they resolved, adding a missing library and something else, but doesn't work with me...
Applications of other users work and the Tomcat server redirect me corretly with a classic localhost:8080..
So how can I resolve my problem?
This is my code: web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>PrimoEsercizio</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
struts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true"></constant>
<package name="default" extends="struts-default">
<action name="getMessage" class="primoPackage.TutorialAction" method="execute">
<result name="success">/success.jsp</result>
<result name="failure">/error.jsp</result>
</action>
</package>
</struts>
TutorialAction.java class
package primoPackage;
public class TutorialAction {
public String execute() {
System.out.println("Ciao, ecco il primo execute");
return "success";
}
}
success.jsp page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Error</title>
</head>
<body>
<p>Reindirizzamento avvenuto con successo!</p>
</body>
</html>