This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Struts and the fly likes org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result" Watch "org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result" New topic
Author

org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result

Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi All,

I am getting the following exception in my code. Please provide some pointers for solving the issue.

org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result

struts.xml is as follows-



1.) first "kanjiexternaluserprofile" action is called and the page is loaded correctly.
2.) there is form on jsp/ja_JP/externalUserProfile.jsp which submits the form to "kanjiexternalUserProfileSuccess" action
3.) after submitting the form I am getting the exception


Thanks,
Neeraj.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Where's the rest of the stack trace? Where's the JSP fragment that produces the exception on submit?
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
thanks for a prompt reply

following is the jsp fragment


and

following is the stack trace

David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

There's either validation being run or a type conversion exception.
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
I updated the struts.xml . it was just a hit and trial method.



changed the result name from "success" to "input" in action "kanjiexternalUserProfileSuccess"and it's working.

is it required to have a result name "input" when you are redirecting the control to the same jsp page rather than sending the control to some other jsp/action.

In the above case Action name was also the same.

I am still not sure about the reason.. any guidance will be a great help.

Thanks
Neeraj.



David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

No, it's not required to have an "input" result.

I told you the reason; it's either a validation or type conversion issue. You didn't post the form or the action to which it submits, so it's impossible to help any further.
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Hi,

I had given the form submission line of jsp in my previous post. here it's again



validation was also happening in the Action Class.

please help, why validations can create the problem.

Thanks,
Neeraj.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

How will the form tag tell me what's in the form and what's in the action?!

If there are validation errors (or type conversion issues) the framework sends the browser back to the form so the things that didn't pass validation can be corrected. By default this is the "input" result.
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
Sorry for not being able to get your words properly.

please elaborate on your wordings "
By default this is the "input" result.
"

if there are validation happenings, then it is required to have an "input" result. Please correct me, if I have misunderstood.

Thanks
Neeraj.
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's not *required*, as the default can be changed. But by default the "workflow" interceptor will return the "input" result if there are validation errors.
Neeraj Vij
Ranch Hand

Joined: Nov 25, 2003
Posts: 315
got it..

How can we change the default behavior.

Thanks
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

http://struts.apache.org/2.x/docs/workflow-interceptor.html
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: org.apache.struts2.dispatcher.Dispatcher serviceAction Could not find action or result