• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 problem-actions cant find the result. WARNING: Could not find action or result

 
David Mbura
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys!
I am trying to run a simple struts 2 HelloWorld application ,when i run it ,says "There is no Action mapped for namespace / and action name HelloWorld."The start up file that collects a name (namecollector.jsp) works,but when i enter the name and click submit it doesnt return the HelloWorld.action.I browse as http://localhost:8080/STRUTSONTEST/namecollector.action.I am sure it is mapping actions and namespace issue but i have tried changing everything and reading old posts but it didnt help.Can somebody please help.I have provided code below.Thank you in advance.

WARNING: Could not find action or result
There is no Action mapped for action name HelloWorld. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:61)
at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
at com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:475)
at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77).......................

my Directory strucure looks like this:
|_Java Resources:src
. strutsexample.HelloWorld.java

|_Web Content
->jsp
. namecollector.jsp
. display.jsp

->META-INF
->WEB-INF
- folder
. struts.xml
- lib
.web.xml

HelloWorld.java

namecollector.jsp


display.jsp


struts.xml


web.xml


 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put struts.xml in source folder.
 
David Mbura
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried that but it didnt work at all.
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting the feeling that struts.xml is not readable to application otherwise everything is fine in struts.xml.
Is it really in the source folder..?
 
David Mbura
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is in the source directory,but at the same time you are right that struts.xml cant be read, i think my big problem is building path issue.How do you change the java resource directory to
/WebContent/WEB-INF/classes?
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can change your Class path in the Project Properties .....Changing java build Path...

Let me know if you configure it..


regards,
Raza
 
Yemi Dalley
Greenhorn
Posts: 12
MyEclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is an error that i got very often when i stated using struts. I'm surprised the struts docs don't warn new developers about this major gotcha.

back to your problem , In my experience most often than not you get this error when the result type is unknown

in your case


returns "success" not "SUCCESS"

so change your result name from



to



I hope this helps
 
David Mbura
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After clicking properties and then java build path where do you go next because there are about four tabs on top (source,projects,libraries and order and export) and each gives you different buttons,how do you proceed from there and which button you click next?Thank you Raza
 
Raza Mohd
Ranch Hand
Posts: 247
Java MyEclipse IDE MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Go to source tab and browse you class path from there.
I think you changed the default class path that was what your problem.
<application Name>/WebContent/WEB-INF/classes

It will work

Regards,
Raza.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic