About adding parameters,I thought maybe it's easy to specify the root object of the json result while you use the action object as default.for example: <result type="json"> <param name="json.root">currentUser</param> </result>
currentUser is a ognl expression. I could get more flexible json format than now, and I thought it's very easy to do that. I just tried a ajax framework named "ext" which grid componet is very cool.I think maybe you could try to support it in struts2,even as a plugin.Ext is more powerful than dojo.Though dojo is easy but poor function.Struts2 is a very flexible framework.It could be more popular if it support very cool ui. ps.ext website:http://www.extjs.com/ On 3/26/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:
Hi Joey Could you send me a testcase for the problem you are having, like a sample action that will break the json generation? I thought about adding parameters a while back, the problem is that the parameters work for the action, but if you have an object returned by one of the getter methods in the action, then there would be no way to control the json generation for that object. regards musachy On 3/25/07, joey <[EMAIL PROTECTED]> wrote: > > I just tried to generate json result by using Json plugin. > But I found that the result is cutted,not a well-formed json result. > After debugging ,I found the reason,one of my string property of the > struts action isn't a iso-8859-1 encoding string. > In the method "execute" of class JSONResult,you could find : > response.setContentLength(json.length); > response.setContentType("application/json;charset=" + getEncoding()); > When the json.length is smller than json.getBytes(encoding).length, > the result will be cut. > So I thought maybe it's better to change json.length to > json.getBytes(encoding).length. > Moreover,I thought it's better if I could set which property to be > serialized in the struts.xml.It could be more flexible than the > annotation. > For example: > <result type="json"> > <param name="json.includeParam">name,email</param> > </result> > -- "Hey you! Would you help me to carry the stone?" Pink Floyd