struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mead Lai <laiqi...@gmail.com>
Subject Re: JSON plugin suggest : parse String value "" to Number with null / 0
Date Tue, 23 Nov 2010 01:08:11 GMT
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, Knight Chen <dolt131943@gmail.com> wrote:

> Hi all,
>
> I often encounter Number format exception when I use JSON plugin to
> parse input String "" from AJAX request to Number,
> because in Web front,  that will be a zero length String "" transfer
> to backend if the text input has no enter,
> so will encounter the Number format exception for input String "".
>
> I check the JSONPopulator, that has process the null value to 0 when
> parse to Number type, but not process the String "",
> So can JSONPopulator to support process String "" to null or 0,that
> will be easier web front develop.
>
>
> --
> ========================
> Knight Chen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

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