• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Custom result type reference is causing my deploy to fail

 
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!!
 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic