struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Nenning <Christoph.Nenn...@lex-com.net>
Subject Re: Json result
Date Mon, 01 Sep 2014 07:48:02 GMT
> Hi,
> 
> Conisider this action:
> 
> SampleAction{privateList<SampleVO>samples;//With setters and 
> gettersprivateList<AnotherVO>anotherList;//With setters and 
> gettersprivateStringanString;//With setters and getters@Action(value
> ="/loadSelect",results ={@Result(name ="success",type ="json")})
> publicStringloadSomeSamples(){samples =newArrayList<SampleVO>();//
> Put some object in samples.returnSUCCESS;}}
> This will result to:
> 
> {"samples":{"0":{"property":"a"},"1":{"property":"b"},"2":
> {"property":"c"}},"anString":"hello","anotherList":{"0":
> {"prop1":"a","prop2":"b"},"1":{"prop1":"c","prop2":"d"}}}
> Is it possible to configure json result to make below result
> 
> 
{"samples":{"0":{"property":"a"},"1":{"property":"b"},"2":{"property":"c"}}}
> 
> ~Regards,
> ~~Alireza Fattahi



You can use the "excludeProperties" parameter, see:


https://struts.apache.org/release/2.3.x/docs/json-plugin.html



regards,
Christoph

This Email was scanned by Sophos Anti Virus

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message