开发者

Struts:JSON:return multiple objects

开发者 https://www.devze.com 2022-12-24 12:00 出处:网络
Is it possible to return multiple JSON objects in the request header with Struts1?I am presently returning a single JSON objects, however the need now is to return a second data structure. All the cli

Is it possible to return multiple JSON objects in the request header with Struts1? I am presently returning a single JSON objects, however the need now is to return a second data structure. All the client-side processing works perfectly for the single data structure in the single JSON objects, I really do not want to complicate it by putting two hetrogenous data structures in a single return 开发者_StackOverflow中文版JSON object. tia.


I don't know struts or why you can't return multiple JSON objects, but if you genuinely can't, why don't you return a list of your objects? you can unbox them at the receiving end.

in other words, if you were previously returning obj = {...}, and now need to return that as well as obj2 = {...}, you can return [obj, obj2].

maybe this doesn't solve your problem, but it'll get you around it pretty easily.

0

精彩评论

暂无评论...
验证码 换一张
取 消