spring mvc 接收data值报400
来源:互联网 发布:女士手套品牌 知乎 编辑:程序博客网 时间:2024/06/04 22:47
1创建 BaseController类(类型解析类)直接复制即可
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import sun.beans.editors.DoubleEditor;
import sun.beans.editors.FloatEditor;
import sun.beans.editors.IntEditor;
import sun.beans.editors.LongEditor;
public class BaseController {
@InitBinder
public void initBinder(WebDataBinder binder) {
binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(“yyyy-MM-dd”), true));
binder.registerCustomEditor(int.class, new IntEditor());
binder.registerCustomEditor(long.class, new LongEditor());
binder.registerCustomEditor(double.class, new DoubleEditor());
binder.registerCustomEditor(float.class, new FloatEditor());
}
}
2 xxx extends BaseController
3 data类型加入
@DateTimeFormat(pattern = “yyyy-MM-dd”)
private Date ahregistrardate;
- spring mvc 接收data值报400
- Spring MVC @RequestBody接收JSON报HTTP 415/400问题的解决
- Spring MVC @RequestBody接收JSON报HTTP 415/400问题的解决
- Spring MVC @RequestBody接收JSON报HTTP 415/400问题的解决
- Spring MVC 注解接收json数据报错415
- Spring MVC Data Binding
- spring mvc 接收时间参数
- spring mvc接收json参数
- Spring MVC 接收数组参数
- Spring MVC @RequestBody接收JSON报HTTP Statusd 415的问题
- spring mvc开发接收日期字段表单提交,自动转换成Date类型报错,解决办法
- spring mvc开发接收日期字段表单提交,自动转换成Date类型为什么报错?
- spring mvc 集成 spring data jpa
- spring mvc+spring data+mongodb实例1
- spring MVC 接收PUT方式请求
- ajax json list spring mvc接收
- Spring MVC接收参数的方式
- spring mvc 接收返回json串
- Python 3.6学习笔记(一)
- Android 动态申请权限(AndPermission)
- JQuery 插件与扩展方法的范例
- GitLab 之 Git LFS 大文件存储的配置
- hdu2841(容斥原理+分解质因数)Visible Trees
- spring mvc 接收data值报400
- vm虚拟机上安装了oracle,更改了虚拟机的网络连接类型之后oracle连不上了
- linux安装配置java环境
- 3. TVTK的管线
- 【Java笔记】static和final关键字的初级理解应用
- MVC数据验证
- ToolBar距离左边界留白解决方案
- Python中MD5加密字符串
- JSON 与 对象 、集合 之间的转换