This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Custom result type reference is causing my deploy to fail

 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry.. the code which I specified as JSP is Struts.xml
 
Chris Montgomery
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.


 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic