zoukankan      html  css  js  c++  java
  • 前端传日期搜索报错

     前端传日期的时候报下面的错误:

    Field error in object 'orderInfoVO' on field 'orderTimeEnd': rejected value [2020-11-08 15:34]; codes [typeMismatch.orderInfoVO.orderTimeEnd,typeMismatch.orderTimeEnd,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [orderInfoVO.orderTimeEnd,orderTimeEnd]; arguments []; default message [orderTimeEnd]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'orderTimeEnd'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [@org.springframework.format.annotation.DateTimeFormat java.util.Date] for value '2020-11-08 15:34'; nested exception is java.lang.IllegalArgumentException: Invalid format: "2020-11-08 15:34" is too short]

    有两个地方需要注意:

    1、,将日期加上@DateTimeFormate

    2、xml中的判空不能加 ‘’空字符串的判空,只能加!=null的判空

  • 相关阅读:
    多表查询
    Java基础
    group by 和 having 用法
    多态
    修改用户权限
    集成测试过程
    系统测试
    软件验收测试通过准则
    性能测试、负载测试、压力测试的区别
    白盒测试
  • 原文地址:https://www.cnblogs.com/gslgb/p/13920757.html
Copyright © 2011-2022 走看看