Steve Brierton
2011-09-28 01:08:23 UTC
Hello,
I'm going through the Struts 2 Annotation tutorial and I'm having problems
with the first part of it, the "hello" convention plugin part. I'm getting
"There is no Action mapped for namespace / and action name hello." Along
with the following stack trace (partial):
There is no Action mapped for namespace / and action name hello. - [unknown
location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:1
89)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsAct
ionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultA
ctionProxyFactory.java:58)
....
My index.jsp has the following link:
<p><a href="<s:url action="hello" />" >Get your hello.</a></p>
I have a WebContent/WEB-INF/content/hello-success.jsp that is the following:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %> <!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>Hello</title> </head> <body> <h3><s:property value="message" /></h3>
<p><a href="index.jsp" >Return to home page</a>.</p>
</body>
</html>
I've searched the web and I've seen places mention about setting the
package.locator and action.suffix in the struts.xml so I've set my
struts.xml to this (it resides in my src folder):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.convention.package.locators" value="actions"/>
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
</struts>
My jar files (I got them out of the tutorial) are located in WEB-INF/lib and
are:
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemarker-2.3.16.jar
javassist-3.7.ga.jar
log4j-1.2.14.jar
ognl-3.0.jar
struts2-config-browser-plugin-2.1.8.1.jar
struts2-convention-plugin-2.2.1.jar
struts2-core-2.2.1.jar
xwork-core-2.2.1.jar
I'm using Eclipse and jre6.
Thank you for your assistance,
Steve
I'm going through the Struts 2 Annotation tutorial and I'm having problems
with the first part of it, the "hello" convention plugin part. I'm getting
"There is no Action mapped for namespace / and action name hello." Along
with the following stack trace (partial):
There is no Action mapped for namespace / and action name hello. - [unknown
location]
com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:1
89)
org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsAct
ionProxyFactory.java:39)
com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultA
ctionProxyFactory.java:58)
....
My index.jsp has the following link:
<p><a href="<s:url action="hello" />" >Get your hello.</a></p>
I have a WebContent/WEB-INF/content/hello-success.jsp that is the following:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="s" uri="/struts-tags" %> <!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>Hello</title> </head> <body> <h3><s:property value="message" /></h3>
<p><a href="index.jsp" >Return to home page</a>.</p>
</body>
</html>
I've searched the web and I've seen places mention about setting the
package.locator and action.suffix in the struts.xml so I've set my
struts.xml to this (it resides in my src folder):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.devMode" value="true"></constant>
<constant name="struts.convention.package.locators" value="actions"/>
<constant name="struts.convention.action.suffix" value="Controller"/>
<constant name="struts.convention.action.mapAllMatches" value="true"/>
</struts>
My jar files (I got them out of the tutorial) are located in WEB-INF/lib and
are:
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
freemarker-2.3.16.jar
javassist-3.7.ga.jar
log4j-1.2.14.jar
ognl-3.0.jar
struts2-config-browser-plugin-2.1.8.1.jar
struts2-convention-plugin-2.2.1.jar
struts2-core-2.2.1.jar
xwork-core-2.2.1.jar
I'm using Eclipse and jre6.
Thank you for your assistance,
Steve