Olá Galera,
Alguem de vcs ja conseguir fazer funcionar o Struts2 com action dinamicas, tudo que eu pequei na net nao funciona.
Olha o que eu tenho:
struts.xml
<struts>
<package name="default" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="*Link" method="{1}" class="com.teste.action.LinkAction">
<result name="welcome">/welcome.jsp</result>
</action>
</package>
</struts>
web.xml
<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>
minha classe:
public class LinkAction extends ActionSupport {
public String welcome()
{
return "welcome";
}
}
minha pagina index.jsp
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=welcomeLink.action">
minha pagina welcome.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>Insert title here</title>
</head>
<body>
Welcome Guest.
</body>
</html>
Minhas libs:
commons-beanutils-1.7.0.jar
commons-digester-2.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-logging-1.0.4.jar
commons-logging-api-1.1.jar
freemarker-2.3.15.jar
junit-3.8.1.jar
ognl-2.7.3.jar
struts2-codebehind-plugin-2.1.8.1.jar
struts2-convention-plugin-2.1.8.1.jar
struts2-core-2.1.8.1.jar
xwork-core-2.1.6.jar
Ao tentar acessar sempre da o seguinte erro:
LOG:
WARNING: Could not find action or result
There is no Action mapped for namespace / and action name welcomeLink. - [unknown location]
PAGINA:
HTTP Status 404 - There is no Action mapped for namespace / and action name welcomeLink.
Alguem tem alguma ideia do que eu estou fazendo de errado ?
Obrigado,
Rodrigo