aspose file tools*
The moose likes Struts and the fly likes Custom result type reference is causing my deploy to fail Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Custom result type reference is causing my deploy to fail" Watch "Custom result type reference is causing my deploy to fail" New topic
Author

Custom result type reference is causing my deploy to fail

Chris Montgomery
Ranch Hand

Joined: Jan 14, 2004
Posts: 141
I feel like I've implemented my custom result type correctly, yet tomcat hates me and refuses to deploy my app...

Error Message:
There is no result type defined for type 'captchaImage' mapped with name 'success'. Did you mean 'captchaImage'? - result -

struts.xml

I'm not using any plugins.
I get the same error whether my jcaptchaImage.action references a class or not
Based on a few book references, it all looks good.

My goal is to have my captcha image's src reference my action:



Thanks!!
pooja par
Ranch Hand

Joined: Feb 14, 2011
Posts: 31
you are using result-type in the wrong way

result-type specifies whether the result should be map, list, json etc..
Please see the below sample code
JSP

"managerNames" is the array of strings which I am returning from the action class.. But I want to display them in JSON format.. so I mentioned result-type as json.
Action.java
pooja par
Ranch Hand

Joined: Feb 14, 2011
Posts: 31
sorry.. the code which I specified as JSP is Struts.xml
Chris Montgomery
Ranch Hand

Joined: Jan 14, 2004
Posts: 141
I'm not sure I'm convinced.

The way I understand it, the result type 'name' attribute is just that. a name. I can chose any string I want - like "json" in your example.
In addition to the name attribute, you must enter a class attribute to point to your custom Result class.
Finally in your action, you should be able to reference that newly created result type by its name.

Tomcat shouldn't care about the name I've used, it's just a pointer to my class isn't it?
My guess is that if you rename your result type from "json" to "myCustomJSON" and reference that in your action configuration, it will still work.

What's actually return is based on what is loaded in your execute method of your Result class.
Here's an example method taken from a tutorial:


As you can see, it's just loading up the response object with 'stuff', so your JSP can do things with it.
I have the action coded and the Result coded, I'm just trying to figure out how to convince Tomcat my configuration is correct!

I actually think I don't even need to go this route. I'm starting to see evidence that I can load up the response object from my action after all (rather than creating a Result class).
I'll post my results.


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Custom result type reference is causing my deploy to fail