[RESOLVIDO] Dúvida com HelloWorld Struts2

2 respostas
pinguin-suni

Bom dia Amigos,

Estou tentando fazer um HelloWorld utilizando apenas o Struts2 para aprendizagem… entretanto não estou obtendo êxito…
Esta me sendo retornado a mensagem:

[i]HTTP Status 404 -

type Status report

message

description The requested resource () is not available.
Apache Tomcat/6.0.26
[/i]

Fiz várias pesquisas na net por esta mensagem de erro mas não obtive sucesso para solucionar o problema! :frowning:

Abaixo seguem o conteúdo dos meus arquivos e um print da estrutura do meu projeto:

OlaMundoAction.java

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";
	}
}

olaMundoStruts.jsp

<%@ 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>Struts</title>
</head>
<body>
	<h2>Ola Mundo Com Strutus 2!</h2>
</body>
</html>

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>

Agradeço pela ajuda!

:idea:

2 Respostas

carlos_hen

Segue esse aqui:

http://struts.apache.org/2.2.1/docs/hello-world-using-struts-2.html

Flws

pinguin-suni

Grato,

Mas pesquisei mais um pouco e encontrei meu problema… além das libs que já estavam no projeto estavam faltando essas outras 2:

commons-lang-2.5.jar

e

asm-3.1.jar

Obrigado pela ajuda!!!

Criado 1 de agosto de 2011
Ultima resposta 1 de ago. de 2011
Respostas 2
Participantes 2