Olá
no struts 1 eu mapeo a action dessa maneira:
<action path="helloworld "name="HelloWorld" type="example.HelloWorld">
<result>/example/HelloWorld.jsp</result>
<result>/example/listaCliente.jsp</result>
</action>
e executo a action dessa maneira:
http:\locathost:8080\teste\helloworld.do
Agora como faço para executar essa acttion do struts 2? falta alguma coisa no mapeamento?
<action name="HelloWorld" class="example.HelloWorld">
<result>/example/HelloWorld.jsp</result>
<result>/example/listaCliente.jsp</result>
</action>
Grato
aleck
#2
Utilize o .action no lugar do .do .
Olá
Aleck
Executei conforme vc me instruiu mais não deu certo nao
http://localhost:8080/struts2/HelloWorld.action
Erro:
type Status report
message There is no Action mapped for namespace / and action name HelloWorld.
description The requested resource (There is no Action mapped for namespace / and action name HelloWorld.) is not available.
Parece que tem algo errado no mapeamento.
Tem ideia do que possa ser?
Grato
aleck
#4
No web.xml
<filter>
<filter-name>struts-cleanup</filter-name>
<filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
</filter>
<filter>
<filter-name>struts</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts-cleanup</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
No struts.xml
<action name="consultarPedido" class="br.com.teste.action.ConsultarPedidoAction" method="execute">
<result name="fwd-entrada-consulta">/WEB-INF/jsp/entrada-consulta.jsp</result>
</action>
inforjo
#5
Não sei criar uma classe action.
WEB_INF / classe / br / com/ x / x / x / action e form
quando abro não consigo modificar o arquivo.class
mudo a extensão e quando abro aparece codigo maluco.