> Oleg V Alexeev wrote: >ActionForm must store field values between user >submits and the best choice for type of properties in ActionForm is >java.lang.String.
I've been chewing on the data type issue on ActionForms and I am starting to agree with Oleg that Strings are the best datatypes for ActionForms. I would like to solicit ideas on what everyone is doing in this vein. Specifically, how are you typing Dates? For instance, if you define: /** Getter for property poDate. * @return Value of property poDate. */ public java.util.Date getPODate() { return poDate; } /** Setter for property poDate. * @param poDate New value of property poDate. */ public void setPODate(java.util.Date poDate) { this.poDate = poDate; } and the user types in "blah", how does Struts set that value into a date? Assuming I have not defined form.validate(), how could this work? Similarly, what does Struts do if the date is in the wrong format? Most datatypes have constructors which accept Strings (even BigDecimal) but java.util.Date doesn't. The only answer that I can fathom right now (testing all of this over the weekend...) is to specify all dates as Strings and do a dateFormat.parse(strVal); on each - either in the form.validate() method or in the Domain Object setter. Following this line of thinking, why not do the same for BigDecimal? Andy **************************** Andrew Goodnough Dana Commercial Credit Programmer Oleg V Alexeev To: "Struts Users Mailing List" <[EMAIL PROTECTED]> <oalexeev@apa cc: che.org> Subject: Re: anyone using Castor with Struts? 02/22/2002 05:40 AM Please respond to "Struts Users Mailing List" Hello John, We use Castor & Struts in our projects. The right way to use Castor is to develop beans to work with entities from the problem domain, develop database structure and mapping configuration. And after that develop your Struts application. Struts' ActionForms are presentation specific classes - a some kind of informational proxy between entity beans and HTML form data from user input. Action classes incorporates business logic and work with Castor to take and store entity beans from/to persistence storage. I think that idea to use ActionForm as beans in Castor mapping is a potential source of problems. ActionForm must store field values between user submits and the best choice for type of properties in ActionForm is java.lang.String. Entity beans can contains any type properties and all values for it you can transfer from the ActionForm with help of BeanUtils.populate() method, which perform automatic conversion of the field values between String values and such types as Data, Integer and so on. Friday, February 22, 2002, 7:30:12 AM, you wrote: JM> I am considering using Castor as a Persistance mechanism with Struts. Does JM> anyone currently use Castor? Since Castor is desinged to work with any bean JM> like class, to implement castor should I use Castor QQL directly from my JM> ActionForm classes or should there be some kind of redirection from the JM> ActionForm to a more Castor specific class? JM> -john JM> -- JM> To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> JM> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- Best regards, Oleg mailto:[EMAIL PROTECTED] -- To unsubscribe, e-mail: < mailto:[EMAIL PROTECTED]> For additional commands, e-mail: < mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>