result-type specifies whether the result should be map, list, json etc..
Please see the below sample code
"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.
Joined: Feb 14, 2011
sorry.. the code which I specified as JSP is Struts.xml
Joined: Jan 14, 2004
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.
subject: Custom result type reference is causing my deploy to fail