It sounds like you should leave your property as an Integer but have your
getter and setter return/accept Strings.  Then do whatever conversions you
want in your getter and setter to convert your Integer to/from Strings.

I'm new to Struts too, but with regard to what datatypes are supported,
you'll find that Struts is pretty flexible.  For example, it does the
conversions that are normally appropriate to convert the types that are used
in your property accessor methods for use by each html tag type (eg. text,
select, checkbox, radio).  The String type is the lowest common denominator
if you need to do anything special.

Vic

> -----Original Message-----
> From: Bryan Field-Elliot [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, March 08, 2001 11:44 AM
> To:   [EMAIL PROTECTED]
> Subject:      ActionForm question (repost)
> 
> 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

Reply via email to