一.后台往前台传值
默认输出的是毫秒值,需要使用特定的格式

1.在属性上添加@JsonFormat注解,注意要添加时区
springMVC对时间类型的处理
2.在总配置文件添加相关配置
springMVC对时间类型的处理
二.前台往后台传参时(包含日期)
如果不能解析,会报一个400的错误
解决方案:
1.在日期参数上添加@DateTimeFormat注解
springMVC对时间类型的处理
2.在Controller中添加initBinder方法
springMVC对时间类型的处理
如果两种都有,会使用initBinder方法的

相关文章:

  • 2021-10-30
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-05
  • 2022-12-23
  • 2021-12-28
  • 2021-07-11
  • 2021-07-17
  • 2022-12-23
  • 2021-11-26
相关资源
相似解决方案