如题。
转载自:http://blog.youkuaiyun.com/_chage/archive/2005/03/09/315977.aspx
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.util.Date">
<bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
<constructor-arg index="0">
<bean class="java.text.SimpleDateFormat">
<constructor-arg><value>yyyy-MM-dd</value></constructor-arg>
</bean>
</constructor-arg>
<constructor-arg index="1"><value>false</value></constructor-arg>
</bean>
</entry>
</map>
</property>
</bean>
<bean id="datetestBean" class="com.huatek.model.DateTestBean">
<property name="date"> <value>1981-01-01</value> </property>
</bean> 转载自:http://blog.youkuaiyun.com/_chage/archive/2005/03/09/315977.aspx
本文介绍了如何使用Spring框架中的CustomDateEditor来配置日期类型的属性,通过设置SimpleDateFormat为'yyyy-MM-dd'格式来确保日期数据的正确解析。
533

被折叠的 条评论
为什么被折叠?



