
Originally Posted by
vishal.layka
Calendar.getInstance().getTime() returns Date object
then this is howu use CustomDateEditor class for convertign date strings into java.util.Date properties
First, declare an instance of it in the bean configuration file.
<beans ...>
...
<bean id="dateEditor"
class="org.springframework.beans.propertyeditors.C ustomDateEditor">
<constructor-arg>
<bean class="java.text.SimpleDateFormat">
<constructor-arg value="yyyy-MM-dd" />
</bean>
</constructor-arg>
<constructor-arg value="true" /> // indicates this editor allows empty values.
</bean>
</beans>
Then register this property editor in a CustomEditorConfigurer instance
<beans ...>
...
<bean class="org.springframework.beans.factory.config.Cu stomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.util.Date">
<ref local="dateEditor" />
</entry>
</map>
</property>
</bean>