> ActionForm has a object that has a Date property that I want to set. > > So I have > > <html:text property="object.date"> > > 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 property. How > can I get it to display in the MM/DD/YYYY format instead? > Likewise, how > do I make it so the user can enter a date in the format of MM/DD/YYYY > and have it correctly set the Date property?
I'd have the getter format the Date as a string (use SimpleDateFormat.format(), you can specify any of a wide variety of formats). Likewise, the setter should accept a string and use SimpleDateFormat.parse() to turn it into a Date. If parse() returns null then the String could not be turned into a Date, and you need to display an error message. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]