Jun 19th, 2012, 04:51 PM
CustomPropertyEditor not being used in successView
I've been working on this for too long, so it's time to punt:
We have a SFC that we use to present a search form ( formView ) , then on submission, show both the form at the top and the results at the bottom. To do this, in the onSubmit we create the ModelAndView :
ModelAndView mv = new ModelAndView ( this.successView, "command", command ) ;
mv.addObject ("results", searchResults);
Two of the form's fields are dates, and we have a Custom Property editor set in the initBind. The dates are received fine, in other words I see the setAsText () called. If validation fails, the form is redisplayed and the dates are properly printed , meaning getAsText () is called.
BUT, when the form submits and onSubmit returns with the form set in the Model, the spring tags don't call the property editor at all, and our date is presented as if toString was called. With java.sql.DAte being the type, it prints yyyy-mm-dd, with java.util.Date it does "Thu Dec 27 20:44:17 CST 1984".
TLDR: how do I force a propertyEditor to be used if the tag isn't using it?
Tags for this Thread