Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

no Action mapped for namespace / and action name HelloWorld

 
Bhaarat Sharma
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
     
    Bhaarat Sharma
    Ranch Hand
    Posts: 96
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 2068
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 2
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 3
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 154
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I am also facing same issue??
    Please provide me some solution
     
    Mohan rvscas
    Ranch Hand
    Posts: 39
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    It is sorta covered in the JavaRanch Style Guide.
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic