Nov 7th, 2006, 04:29 AM
Binding dates that appear as 3 strings in a form
Up till now we have been entering dates in a SWF app as single strings on a from, and then using a custom property editor to bind this to a date on the domain model. So you enter a string like 10/12/1989 and it creates the appropriate date.
This works very well.
We have another application (struts) that has dates displayed on the screen as three fields e.g. 10 12 1989.
In the struts code there are many implications of doing this:
you have to have 3 separate fields for each date on the struts form, so if you have 10 dates on a screen you have 30 date fields in the struts form, and 10 dates in the domain model (c.f. Spring, no dates in the form, 10 dates in the domain model).
You have to write some mapping code to take each set of three fields and map them to and from dates in the domain model (c.f. Spring - write one custom property editor for dates, with automatic validation thrown in).
As it is a user requirement to have the dates split up into 3 fields on the JSP, can anyone think of an easy way of doing this other than aping the Struts code ?