wood burning stoves 2.0*
The moose likes Struts and the fly likes no Action mapped for namespace / and action name HelloWorld Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "no Action mapped for namespace / and action name HelloWorld" Watch "no Action mapped for namespace / and action name HelloWorld" New topic
Author

no Action mapped for namespace / and action name HelloWorld

Bhaarat Sharma
Ranch Hand

Joined: Jun 04, 2007
Posts: 96
Hello,

I am just starting with struts 2 and I am already frustrated. Hopefully someone can come to the rescue.

I just unzipped the struts2-blank-2.0.11.war that comes along with struts2. I am using netbeans 6.1 so i created new web project with existing source and passed in the path for the place where i unzipped struts2-blank-2.0.11.war. My struts.xml is under source packages

No i click on project and build and then run...but when i click the HelloWorld.jsp page i get this error
"there is no Action mapped for namespace / and action name HelloWorld".

I fail to understand why this is happening. I have not changed anything in the source code at all.

Please, any help would be appreciated.
[ November 05, 2007: Message edited by: bhaarat sharma ]

omnipresent
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
I'm more of an Eclipse man myself. When I imported the struts-blank.war file into Eclipse, it worked the first time.

I've been wanting to play with NetBeans 6, though, so I just downloaded the beta and decided to try loading the Struts-blank-2.0.11.war file. Sure enough, I got the same problem you did. After fiddling with it for a while, here's what I found works:
  • NetBeans likes having a surrounding project folder outside of the unzipped war file. I Created a folder named Struts211Project in my home directory and unzipped the war file into a subfolder named Struts211 within Struts211Project.
  • When creating the new project, I pointed to the project file (Struts211Project)
  • I changed the web context from the default Struts211Project to Struts211.
  • Since NetBeans saw a bunch of JSPs in the example folder, it wrongly concluded "Web Pages Folder" should be <home>/Struts211Project/Struts211/example. I had to correct this. So, I changed the "Web Pages Folder" to <home>/Struts211Project/Struts211.
  • It got all the other folder names right (source, WEB-INF, etc.) so I just took the defaults for these.


  • Once I did the above, it worked fine.
    [ November 05, 2007: Message edited by: Merrill Higginson ]

    Merrill
    Consultant, Sima Solutions
    Bhaarat Sharma
    Ranch Hand

    Joined: Jun 04, 2007
    Posts: 96
    Hi,

    Thanks a lot! that worked like a charm. You should make a blog about that..its a really good detailed solution
    Priyanka Shah
    Greenhorn

    Joined: Feb 06, 2008
    Posts: 1
    I have checked for the things as You suggested. Everything looks fine but still I am getting the error message "There is no Action mapped for action name doLogin". I have added the action in struts.xml as <action name="doLogin" class="p1.Login"> and <package name="p1" namespace="/p1" extends="struts-default"> and I am accessing the action as <s:form action="p1/doLogin.action" method="POST"> .I have also added the struts.xml in class path. I am new to Struts 2. It may be silly problem but I am stuck on that.Please help Me to get ahead . Thanks in advance.
    Jesus Angeles
    Ranch Hand

    Joined: Feb 26, 2005
    Posts: 2046
    Originally posted by Merrill Higginson:
    I'm more of an Eclipse man myself. When I imported the struts-blank.war file into Eclipse, it worked the first time.

    I've been wanting to play with NetBeans 6, though, so I just downloaded the beta and decided to try loading the Struts-blank-2.0.11.war file. Sure enough, I got the same problem you did. After fiddling with it for a while, here's what I found works:
  • NetBeans likes having a surrounding project folder outside of the unzipped war file. I Created a folder named Struts211Project in my home directory and unzipped the war file into a subfolder named Struts211 within Struts211Project.
  • When creating the new project, I pointed to the project file (Struts211Project)
  • I changed the web context from the default Struts211Project to Struts211.
  • Since NetBeans saw a bunch of JSPs in the example folder, it wrongly concluded "Web Pages Folder" should be <home>/Struts211Project/Struts211/example. I had to correct this. So, I changed the "Web Pages Folder" to <home>/Struts211Project/Struts211.
  • It got all the other folder names right (source, WEB-INF, etc.) so I just took the defaults for these.


  • Once I did the above, it worked fine.

    [ November 05, 2007: Message edited by: Merrill Higginson ]

    I used RAD 7.5(eclipsed-based), and ran on embedded WAS 6 server; and it is failing with 'page not found'.

    When I pointed to Apache Tomcat 6 instead of WAS 6, it ran as expected.

    Any ideas why this is so?
    Indrasish Ghosh
    Greenhorn

    Joined: Oct 08, 2007
    Posts: 2
    I know the post is pretty old but can somebody help me in getting this issue resolved. I am using RAD 7.5. When I am trying to hit the URL it is saying me no action found. Here it goes :-

    Struts.xml
    <struts>
    <constant name="struts.devMode" value="true"/>
    <package name="default" namespace="/" extends="struts-default">
    <action name="verysimple" class="com.packt.s2wad.ch02.sanity.VerySimpleAction">
    <result>/WEB-INF/jsps/VerySimple.jsp</result>
    </action>
    </package>
    </struts>

    In Web.xml (Not very sure why)
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    JSP file exists there.

    When I run with a URL http://localhost:<port>/<WebProjectName>/verysimple it says

    Dispatcher W com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn Could not find action or result
    There is no Action mapped for namespace / and action name verysimple. - [unknown location]
    at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:178)
    at org.apache.struts2.impl.................................

    Any Idea on this?
    Zongjian Feng
    Greenhorn

    Joined: Jan 15, 2008
    Posts: 3
    Indrasish Ghosh wrote:
    ... ...

    In Web.xml (Not very sure why)
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>

    ... ...


    --------------------------------------------
    in web.xml:
    sreedhar Lackka
    Ranch Hand

    Joined: Jul 05, 2008
    Posts: 154
    I am also facing same issue??
    Please provide me some solution
    Mohan rvscas
    Ranch Hand

    Joined: Jul 03, 2010
    Posts: 39
    I am not sure this solution any way my opinion
    .jar file is missing in your library file.
    Find out any other .jar file do your program needed.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: no Action mapped for namespace / and action name HelloWorld
     
    Similar Threads
    Struts2 config error
    Struts2 Action problem Problem
    Struts2 in eclipse 3.4
    Struts2 Newbie needs a hint or two
    Struts2 Annotations