Problema com Struts

6 respostas
X

Estou fazendo a atividade da apostila da caelum (atividade 11.6 á 1º de struts).
Sempre que eu vo executar da o erro 404. Eu já vi vários poste como problemas parecidos e fiz o que eles falava mais não deu certo...

Codigo:

Classe OlaMundoAction
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 a lógica com Struts2");
		return "ok";
	}

}
Arquivo JSP olaMundoStruts.jsp
<html>
<body>
<h2>Olá mundo com Struts2!</h2>
</body>
</html>
Arquivo Web.xml
<?xml version="1.0" encoding="UTF-8"?>  
 <web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">  
     <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>  
  <display-name>fj21-tarefas2</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>
</web-app>

6 Respostas

leonardobhbr

Provavelmente esta faltando lib no seu projeto, como esta sua pasta lib dentro do WEB-INF ?

tem o jar struts2-convention?

http://www.vaannila.com/struts-2/struts-2-example/struts-2-annotations-example-1.html

ssh

Pergunta OFF-Topic:

Onde posso baixar AS aspostilas da caelum?

att,

Flavio_machine

Quando vc baixar as libs tem um projeto que chama struts-blanck é um projeto em branco importa ele para o tomcat ai vc já pode trabalhar.

X

leonardobhbr:
Provavelmente esta faltando lib no seu projeto, como esta sua pasta lib dentro do WEB-INF ?

tem o jar struts2-convention?

http://www.vaannila.com/struts-2/struts-2-example/struts-2-annotations-example-1.html

Tenho os seguintes .jar no meu lib
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemarker-2.3.15.jar
ognl-2.7.3.jar
struts2-convention-plugin-2.1.8.1.jar
struts2-core-2.1.8.1.jar
xwork-core-2.1.6.jar

Segundo o poste http://www.guj.com.br/java/201047-resolvido-nao-consigo-configurar-struts eu preciso deles…

X

OK. Vou tentar quando chegar em casa ( agora eu to no smarth fone).
Se não der certo eu vou aki =D

X

Eu fiz isso continua dando erro:
HTTP Status 404 -

type Status report

message

description The requested resource () is not available.
Apache Tomcat/6.0.33

Sabe oq pode ser???

Criado 17 de outubro de 2011
Ultima resposta 18 de out. de 2011
Respostas 6
Participantes 4