Use Strings. However, I think an empty textfield will set its String
property to "" (empty string), not null.
Bryan Field-Elliot wrote:
> Question reposted (never got any responses) -- please respond, someone :)
>
> Question about creating ActionForm beans --
>
> What kinds of data types are supported? I could not find a reference to
> this in the docs. For example, I want to have an input box on my forms,
> where the user can enter a number. Or, they can leave it blank. I want
> "blank" to show up as null, not zero. Should I implement my ActionForm
> bean as follows?
>
> Integer qty;
>
> Integer getQty() { return qty; }
> void setQty(Integer) { this.qty = qty; }
>
> I've chosen Integer because it can hold a value, OR it can be null
> (which is the behavior I'm looking for).
>
> Will this work, or must I restrict my data types to Strings and do
> conversion somewhere else?
>
> Thanks,
> Bryan