| Author |
Struts 2 doesn't see the Action mapping
|
Brian Manahan
Greenhorn
Joined: Nov 22, 2005
Posts: 7
|
|
Hi, I've set up the official Struts 2 hello world example (found at http://struts.apache.org/2.x/docs/hello-world.html). The action is defined like this in struts.xml: The project is deployed on the server as tutorial, and when I attempt to access "localhost:8080/tutorial/HelloWorld.action" I get this message: There is no Action mapped for namespace / and action name HelloWorld. Has anyone run into this problem and found a way to fix it? I altered the package and action a number of times but nothing worked. I verified that all of the files are on Tomcat and the application starts without a problem.
|
 |
Brian Manahan
Greenhorn
Joined: Nov 22, 2005
Posts: 7
|
|
|
Also, I did try adding namespace="/" to the package as is done in the mailreader example, but that did not work.
|
 |
Brian Manahan
Greenhorn
Joined: Nov 22, 2005
Posts: 7
|
|
|
Solved problem. Unlike Struts 1 where struts-config.xml went in WEB-INF, Struts 2 looks for struts.xml in the base class directory.
|
 |
raman nanda
Greenhorn
Joined: Mar 24, 2008
Posts: 2
|
|
|
Nice i like people that solve their own problems. This is the problem that every beginner of the struts developer faces you can just see that by the amount of search results that show. They generally try to do other things and only thing needed is to place the struts.xml under the classes directory
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
raman please Dont Wake The Zombies, that thread is 2 years old.
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Narsimha Manekar
Ranch Hand
Joined: Mar 05, 2001
Posts: 35
|
|
I had the same problem. I have been searching all over the internet and Brian's reply is the ONLY one that is a precise solution for this problem.
>>Solved problem. Unlike Struts 1 where struts-config.xml went in WEB-INF, Struts 2 looks for struts.xml in the base class directory.
I went back and read http://struts.apache.org/2.1.8/docs/simple-setup.html web page. I realised which part I overlooked. To clarify
read
/tutorial/WEB-INF/classes/
as
/tutorial/WEB-INF/classes/struts.xml
Thanks Brian.
-Rao
|
 |
 |
|
|
subject: Struts 2 doesn't see the Action mapping
|
|
|