Olá, bom dia.
Estou começando a estudar STRUTS, e estou fazendo isso pela apostila da Caelum FJ-21
Eu estou fazendo uma aplicação conforme a apostila que filtra com o Struts, e criei uma classe com uma Annotation e outra que é o resultado(view)
O problema que tenho é que quando eu tento entrar no endereço,
http://localhost:8080/fj21-tarefas/olaMundoStruts
Ele me devolve um erro de 404/not found.
Eu vejo que o problema está no filtro do web.xml.
Segue web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>fj21-tarefas</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>
E por via das dúvidas, a action também.
package br.com.caelum.tarefas.action;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
public class OlaMundoAction {
@Action(value = "olaMundoStruts", results = { @Result(location = "/olaMundoStruts.jsp", name = "ok") })
public String execute() {
System.out.println("Executando logica com struts 2");
return "ok";
}
}
Fucei bastante no core do Struts2 e pelo o que eu entendi, estou direcionando o filtro corretamente, mas mesmo assim continua me informando o erro 404.
Ajuda por favor!
Abraço,
Vinicius