Angular 带角度和弹簧靴的POST请求存在问题
发帖麻烦。我有5个时间字段:4个写用户(工作正常),1个设置系统时间(故障)。 问题字段初始化(时间): 当用户将值设置为字段时间时,POST请求工作正常,当通过函数设置时间时,我在spring boot中得到错误:Angular 带角度和弹簧靴的POST请求存在问题,angular,spring,rest,Angular,Spring,Rest,发帖麻烦。我有5个时间字段:4个写用户(工作正常),1个设置系统时间(故障)。 问题字段初始化(时间): 当用户将值设置为字段时间时,POST请求工作正常,当通过函数设置时间时,我在spring boot中得到错误: 2020-08-18 12:06:25.443 WARN 5340 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved [org.springframework.http.conv
2020-08-18 12:06:25.443 WARN 5340 --- [nio-8080-exec-1] .w.s.m.s.DefaultHandlerExceptionResolver :
Resolved [org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize instance of `java.util.Date` out of START_ARRAY token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.util.Date` out of START_ARRAY token
at [Source: (PushbackInputStream); line: 1, column: 22] (through reference chain: com.kiryushin.pspmonitoring.entity.Calls["time"])]
此为.callForm.patchValue({
日期:formatDate(this.todayDate,“yyyy-MM-dd”,“en”),
时间:formatDate(this.todayDate,“HH:mm”,“en”)
})
您可以通过使用函数来调试代码,当用户提供输入时,该函数起作用,只是为了在将结果发送到API之前比较结果({
日期:formatDate(this.todayDate,“yyyy-MM-dd”,“en”),
时间:formatDate(this.todayDate,“HH:mm”,“en”)
})
当用户提供输入时,您可以使用函数调试代码,为什么它不起作用只是为了在将结果发送到API之前比较结果。上面的代码丢失了。Mamta的工作代码如下:
this.callForm.patchValue({
date: formatDate(this.todayDate,"yyyy-MM-dd",'en' ),
time: formatDate(this.todayDate,"HH:mm",'en' )
})
上面的代码丢失了。Mamta的工作代码如下:
this.callForm.patchValue({
date: formatDate(this.todayDate,"yyyy-MM-dd",'en' ),
time: formatDate(this.todayDate,"HH:mm",'en' )
})
你说得对,这很有效。我将所有解决方案与工作方法进行比较(例如:使用console.log命令打印“time”)。我的任何方法都输出相同的值作为工人。你可以告诉我问题是什么,也许可以发送文档参考?谢谢,你说得对,它很有效。我将所有解决方案与工作方法进行比较(例如:使用console.log命令打印“time”)。我的任何方法都输出相同的值作为工人。你可以告诉我问题是什么,也许可以发送文档参考?非常感谢。