SpringMVC的实现了在方法参数里写入实体类,和前台的name对应可以实现自动注入。但是某些Integer,Long,Data类型传入为空的时候就会报错。

Integer,Long 类型可以在前台进行处理 或者 利用String 类型的别名 传入后台在进行处理;

 

Data类型有两种比较简单的方式,一种就是String类型接收 自己进行转换

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String data = sdf.format(pos.getIn_datetime());

另外一直就是在Entity里添加@DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss"注释

SpringMVC的实现了在方法参数里写入实体类,和前台的name对应可以实现自动注入。但是某些Integer,Long,Data类型传入为空的时候就会报错。

Integer,Long 类型可以在前台进行处理 或者 利用String 类型的别名 传入后台在进行处理;

 

Data类型有两种比较简单的方式,一种就是String类型接收 自己进行转换

SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String data = sdf.format(pos.getIn_datetime());

另外一直就是在Entity里添加@DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss"注释

相关文章:

  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-08
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
  • 2021-12-17
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2023-03-28
相关资源
相似解决方案