Besides, Strings are central to the language - that's why, unlike in other languages, String is a separate, immutable class. You can cast a String to anything, and anything to a String. I only use Strings in my ActionForms and only HashMaps containing Strings in my DynaActionForms. It is no trouble at all to cast the objects to the desired form for, like calculating BigDecimals or using a boolean in a conditional. I also store everything in the database as Strings - even dates. This greatly simplifies data manipulation, and avoids st00pid errors like trying to store floats in the db and expecting a query return with a precision limited to 2.
Mark -----Original Message----- From: Andrew Hill [mailto:[EMAIL PROTECTED] Sent: Friday, May 30, 2003 2:55 AM To: Struts Users Mailing List Subject: RE: Why do ActionForms allow non-string properties? Well firstly for dealing with nested forms, collections of nested forms and the like. One also needs to remember that the ActionForm is an object that represents the state of the UI - and depending on what you are doing you may wish to use it for storing information relating to ui state that doesnt map directly to a form control value, but is used in rendering the view. (ie: things relating to complex 'widgets' you render) You might also have properties that are synonyms for string properties that act as convienience methods for getting and setting the value in its final type - but internally both reference the same String member variable. for example: private String _employeeSalary; private String _ceoSalary; setEmployeeSalary(String employeeSalary) String getEmployeeSalary() setEmployeeSalaryByte(Byte employeeSalary) Byte getEmployeeSalaryByte() setCeoSalary(String ceoSalary) String getCeoSalary() setCeoSalaryBigDecimal(BigDecimal ceoSalary) BigDecimal getCeoSalary() -----Original Message----- From: Steve Raeburn [mailto:[EMAIL PROTECTED] Sent: Friday, 30 May 2003 14:40 To: Struts Users Mailing List Subject: RE: Why do ActionForms allow non-string properties? In what way would it be restrictive? Is there any reason you would need a non-string property (for html input) ? Steve > -----Original Message----- > From: Andrew Hill [mailto:[EMAIL PROTECTED] > Sent: May 29, 2003 11:26 PM > To: Struts Users Mailing List > Subject: RE: Why do ActionForms allow non-string properties? > > > Well, I think it a bit restrictive to forbid non-string properties, > but I would say that the docs really ought to make it clear that the > recommended type for all those properties that directly relate to html > controls should be strings. > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]