Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-24 Thread Knight Chen
Thanks,Maurizio, This is not a wrong approach. but can be take a improved for easier use. :P Regards. On Tue, Nov 23, 2010 at 12:10 PM, Maurizio Cucchiara maurizio.cucchi...@gmail.com wrote: Hi Knight, I take your point, JSONPopulator.convertPrimitive function maybe uses a wrong approach.

RE: JSON plugin suggest : parse String value to Number with null / 0

2010-11-24 Thread Martin Gainty
obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. Date: Wed, 24 Nov 2010 20:16:45 +0800 Subject: Re: JSON plugin suggest : parse String value to Number with null / 0 From: dolt131

Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-24 Thread Maurizio Cucchiara
2010/11/24 Martin Gainty mgai...@hotmail.com if the target attribute is available in object acquired by invocation.getAction() then you should see the target does this answer your question? Actually, It doesn't. I meant that conversion methods like convertPrimitive (see the code below) use

Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-24 Thread Knight Chen
Does this possible? In source code: Object org.apache.struts2.json.JSONPopulator.convertPrimitive(Class clazz, Object value, Method method) throws JSONException { if (value == null) { if (Short.TYPE.equals(clazz) || Short.class.equals(clazz)) return (short) 0;

Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-22 Thread Mead Lai
Hello Knight, I think you can change the Value-Object(Model obj), modify the get method code: if(this.value.equal()){ this.value=null; or this.value=0 } You can pass a Value-Object to server side, instead of Json-Text formation. Regards, Mead On Mon, Nov 22, 2010 at 8:12 PM,

Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-22 Thread Maurizio Cucchiara
I'm not sure understand what you mean, it could be ognl conversion related. For further details, could you provide the NPE stack? 2010/11/22 Knight Chen dolt131...@gmail.com Hi all, I often encounter Number format exception when I use JSON plugin to parse input String from AJAX request to

Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-22 Thread Knight Chen
Hi All, Thanks for reply, and sorry for my poor English. In this case: I have a POJO: public class UserDTO { private int age; ... public void setAge(int age) { this.age = age; } } And Action has a property with this type: public Class UserAction {

Re: JSON plugin suggest : parse String value to Number with null / 0

2010-11-22 Thread Maurizio Cucchiara
Hi Knight, I take your point, JSONPopulator.convertPrimitive function maybe uses a wrong approach. Does anyone know why convert method process is driven by value and type instead of target type only? 2010/11/23 Knight Chen dolt131...@gmail.com Hi All, Thanks for reply, and sorry for my poor