How should I configure the class to bind three dropdowns (date, month, year) to a single Date property so that it works the way it works for 'single request parameter per property' scenario ? I guess a should add some custom PropertyEditors by overriding initBinder method. What else ?
Aleksey Kudryavtsev: you can override the onBind method in your controller, i which you cant fiddle something special in command object, like
dateField = new SimpleFormat("YYYY-mm-dd").parse(this.year + "-" + this.month + "-" this.day);
or:
Calendar c = Calendar.getInstance();
c.set(year, month, day);
dateField = calendar.getTime();
but i'd rather do validation in javascript and use some available date picker component, there are plenty of them...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With