Re: html:text for Date property

2004-04-10 Thread Joe Hertz
27;s the expression? "Some days it doesn't pay to chew through the leather straps." -Joe > -Original Message- > From: Richard Yee [mailto:[EMAIL PROTECTED] > Sent: Friday, April 09, 2004 8:15 PM > To: Struts Users Mailing List; [EMAIL PROTECTED] > Subject: Re:

Re: html:text for Date property

2004-04-09 Thread Richard Yee
Paul, You shouldn't keep an instance of SimpleDateFormat as an instance variable even though you are only using the parse method. The reason is that the SimpleDateFormat class is not thread-safe. This is caused by the fact that the DateFormat class isn't threadsafe due to the fact that a value (the

Re: html:text for Date property

2004-04-09 Thread Paul Barry
This seems to work pretty well: private Date dateOfBirth; private static final DateFormat dateOfBirthFormat = new SimpleDateFormat("MM/dd/"); public Date getDateOfBirth() { return dateOfBirth; } public void setDateOfBirth(Date dateOfBirth) { this.dateOfBirth = dateOfBirth; } public

Re: html:text for Date property

2004-04-09 Thread Christian Bollmeyer
On Friday 09 April 2004 21:19, Paul Barry wrote: Generally, it's a good idea to have only String and boolean properties in an ActionForm and convert the information gathered for further processing lateron. For complex validations (like Dates), I usually check in validate() if the value entered can

RE: html:text for Date property

2004-04-09 Thread Wendy Smoak
> From: Paul Barry [mailto:[EMAIL PROTECTED] > Are their other ways to handle this, so I don't need 2 properties? String properties in the Form, and a utility class to do the conversions when you need to use it as a Date. (Possibly a BeanUtils Converter to do it as part of 'copyProperties' if yo

Re: html:text for Date property

2004-04-09 Thread Paul Barry
Yeah, I guess I could do that. I think need 2 properties. I would create a dateAsString property, have the form get and set that, and then have the getters and setters set and convert the actual Date. This way I can call getDate to get a Date and getDateAsString to get it as a formatted Stri

RE: html:text for Date property

2004-04-09 Thread Slattery, Tim - BLS
> ActionForm has a object that has a Date property that I want to set. > > So I have > > > > If I populate the that property in the Action like this: > > MyObject obj = new MyObject(); > obj.setDate(new Date()); > form.setObject(obj); > > The html:text tag does a toString() on the object.date

html:text for Date property

2004-04-09 Thread Paul Barry
What is the best way to deal with a Date property in an ActionForm? My ActionForm has a object that has a Date property that I want to set. So I have If I populate the that property in the Action like this: MyObject obj = new MyObject(); obj.setDate(new Date()); form.setObject(obj); The html