Meu nome é Cesar e a duvida é a seguinte.
Como eu crio um projeto web usando o struts 2 ?
Valeu.
Meu nome é Cesar e a duvida é a seguinte.
Como eu crio um projeto web usando o struts 2 ?
Valeu.
vc não tem nem idéia de como começar um projeto em struts2 ? Recomendo que leia algum tutorial para fazer a principio um “Hello World”.
No google vc encontra diversos tutoriais.
Por exemplo nestes links
http://www.rafaelcarneiro.net/blog/2007/09/25/struts2-o-inicio/
http://gabrielcardelli.net/wp/?p=17
depois parta para coisas mais elaboradas inclusive com utilização de frameworks.
Pra falar a verdade o struts ta dando um erro de mapeamento, 404, só que esta tudo organizado como manda o figurino.
Segue abaxio a conficguração do xml e a action, as pastas estão exatamente como a apostila da caelum fj21.
A action.
package br.com.action.teste;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;
public class TesteAction {
@Action(value="olamundo",results={@Result(location="olamundo.jsp",name="ok")} )
public String executa(){
return "ok";
}
}
O 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>distribuidora</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>