You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian Knorr <bt...@nextjet.com> on 2002/07/17 22:34:25 UTC

Long property defaulting to zero

We just upgraded from struts 1.0 to struts1.1beta and are encountering an issue with some properties on our forms. If the value being set and returned is a wrapper type like Long, struts is setting the default value to zero instead of null... for example:

public Long getAccountNumber() {
	return accountNumber;
}

public void setAccountNumber(Long accountNumber) {
	this.accountNumber = accountNumber;
}

If on our form we have a hidden field <html:hidden property="accountNumber"/> and when load the form the value for this "empty", but when we submit the form, struts sets the value to zero.  Is this correct or should it be null?  Regardless, does anyone know how to configure struts so that the default value is null rather than zero?

Thanks in advance,

Brian



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Long property defaulting to zero

Posted by "Craig R. McClanahan" <cr...@apache.org>.
The new version of ConvertUtils (from commons-beanutils) changed this
behavior from what was observed in Struts 1.0.  To restore the previous
default, you need to download a very recent nightly build of 1.1 and set
up a servlet initialization parameter "convertNull" with value "true" for
the controller servlet.

Craig


On Wed, 17 Jul 2002, Brian Knorr wrote:

> Date: Wed, 17 Jul 2002 15:34:25 -0500
> From: Brian Knorr <bt...@nextjet.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Long property defaulting to zero
>
>
> We just upgraded from struts 1.0 to struts1.1beta and are encountering an issue with some properties on our forms. If the value being set and returned is a wrapper type like Long, struts is setting the default value to zero instead of null... for example:
>
> public Long getAccountNumber() {
> 	return accountNumber;
> }
>
> public void setAccountNumber(Long accountNumber) {
> 	this.accountNumber = accountNumber;
> }
>
> If on our form we have a hidden field <html:hidden property="accountNumber"/> and when load the form the value for this "empty", but when we submit the form, struts sets the value to zero.  Is this correct or should it be null?  Regardless, does anyone know how to configure struts so that the default value is null rather than zero?
>
> Thanks in advance,
>
> Brian
>
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>