webBindingInitializer 在XML中无效,spring mvc 3.2以版本
来源:互联网 发布:c语言函数库下载 编辑:程序博客网 时间:2024/05/11 17:06
这个仁兄说得好……https://www.oschina.net/question/140550_20454
default message [Failed to convert property value of type 'Java.lang.String' to required type 'java.util.Date' for property 'sdate';
package com.lanyuan.util;import java.text.SimpleDateFormat; import java.util.Date; import org.springframework.core.convert.converter.Converter; /** * spring4 mvc 的日期传递[前台-后台]bug: * 的解决方式.包括xml的配置 * new SimpleDateFormat("yyyy-MM-dd"); 或 new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") * 这里的日期格式必须与提交的日期格式一致 * @author lanyuan * Email:mmm333zzz520@163.com * date:2017-2-20 */ public class SpringMVCDateConverter implements Converter<String, Date> { @Override public Date convert(String source) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); dateFormat.setLenient(false); try { return dateFormat.parse(source); } catch (Exception e) { dateFormat = new SimpleDateFormat("yyyy-MM-dd"); dateFormat.setLenient(false); try { return dateFormat.parse(source); } catch (Exception e1) { e1.printStackTrace(); } } return null; }}
<mvc:annotation-driven conversion-service="conversionService" />
0 0
- webBindingInitializer 在XML中无效,spring mvc 3.2以版本
- spring中@InitBinder和WebBindingInitializer的使用
- 在Spring-MVC.xml中进行配置
- 在web.xml中注册IntrospectorCleanupListener监听器以解决spring mvc等框架可能产生的内存泄露问题
- 一.spring中@InitBinder和WebBindingInitializer的使用
- Spring MVC中AOP无效、不起作用
- Spring MVC中AOP无效、不起作用,解决方案
- 在spring MVC框架中显示xml视图
- Spring mvc接收前端日期类型字符串,AnnotationMethodHandlerAdapter配置webBindingInitializer失效解决方
- Spring.Net在ASP.NET MVC的过滤器Controller中无效
- 什么?response.end在mvc中无效????
- Spring mvc aop 无效
- 在spring-mvc.xml里配置异步
- 在spring中实例化bean无效
- Spring MVC中AOP无效、不起作用,解决方案之一
- Spring MVC中AOP无效、不起作用,解决方案之一
- spring mvc中web.xml的配置
- 在java项目开发中要加入的spring的jar包(以spring 3.1版本为例)
- 51nod 1737 配对 【树形dp】
- 【杂谈】hololens畅想
- 什么是socket
- 堆和栈的认识
- 2016 移动应用质量大数据报告
- webBindingInitializer 在XML中无效,spring mvc 3.2以版本
- dubbo2.5-spring4-mybastis3.2-springmvc4-mongodb3.4-redis3.2整合(十一)之 spring中定时器quartz的整合续集(Quartz集群配置)
- 三得公益人人公益模式系统开发源码
- type: "Normalize"
- Find Bandage Dresses Wholesale on http://www.wholesalebandagedresses.com/
- SPOJ - Distinct Substrings,求不同的字串个数!
- vue的安装
- THU的有趣的OI面试题
- 第一个Python小程序(Hello World!)