springmvc类型转换
来源:互联网 发布:淘宝五星好评 编辑:程序博客网 时间:2024/06/07 23:55
package com.ssfans.core.controller;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;
@Controller
@RequestMapping("/test")
public class TestController implements WebBindingInitializer{
@RequestMapping("/test.shtml")
public void test(Date date){
System.out.println(date);
System.out.println("hello");
}
@InitBinder
public void initBinder(WebDataBinder binder, WebRequest request) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
}
}
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;
@Controller
@RequestMapping("/test")
public class TestController implements WebBindingInitializer{
@RequestMapping("/test.shtml")
public void test(Date date){
System.out.println(date);
System.out.println("hello");
}
@InitBinder
public void initBinder(WebDataBinder binder, WebRequest request) {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
binder.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
}
}
0 0
- springmvc类型转换
- springMVC 类型转换
- SpringMvc 类型转换 Converter
- SpringMVC(五)类型转换
- SpringMVC之类型转换Converter
- springMVC数据绑定、类型转换
- SpringMVC之类型转换Converter
- springMVC类型转换,@initBinder使用
- SpringMVC之类型转换Converter
- springMVC 绑定参数 类型转换
- SpringMVC 之类型转换 Converter
- SpringMVC ----数据进行类型转换
- SpringMVC之类型转换Converter
- SpringMVC之类型转换Converter
- SpringMVC之类型转换Converter
- SpringMVC之类型转换@initBinder
- SpringMVC之类型转换@initBinder
- SpringMvc日期类型转换问题
- java小小工具第二弹 画图
- android view动画类型
- 源码一
- 一个帖子学会Android开发四大组件
- jsp隐式对象
- springmvc类型转换
- 类似于qq登录时账号密码的保存
- Swift的变量和常量
- 树的子结构
- DBMS_UTILITY.GET_CPU_TIME和DBMS_UTILITY.GET_TIME
- android中使用xml里的array资源
- super 关键字
- 1.排序之冒泡排序算法
- malloc与new函数详解