struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From JP Cafaro <>
Subject Re: result-type using annotations
Date Tue, 13 Jul 2010 23:21:37 GMT
Thanks for the response.  I've been actually looking into the json 
plugin but having problems...

I'm using the json plugin that comes with struts 2 (json-lib-2.1.jar) 
and trying to follow the website to set it up.

Here's my struts.xml

       <package name="example"  extends="json-default">
          <action name="AjaxRetrieveUser" class="actions.view.RetrieveUser">
             <result type="json"/>

but I get this warning:
SEVERE: Unable to find parent packages json-default

Is there something else I'm supposed to do?

Allen Lee wrote:
> You can do this via the json plugin
> ( - bundled with struts
> 2.1.7+) that provides the json result type, i.e., @Result(name="foo",
> type="json", ...) or you could set the contentType in your @Result
> params as application/json and have your associated template emit the
> exact json that you want to return.
> On Tue, Jul 13, 2010 at 5:34 AM, JP Cafaro <> wrote:
>> Is it possible to declare result-type using annotations?  For example, when
>> trying to return an object, that gets serialized to json, is it possible to
>> move away from the struts.xml <result-type> and do it via annotations
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message