2018-10-29 13:35:33.639 WARN 2212 — [nio-8080-exec-2] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved exception caused by handler execution: org.springframework.beans.TypeMismatchException: Failed to convert value of type ‘java.lang.String’ to required type ‘com.elemeHelper.entity.Cookie’; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.lang.Long] for value ‘fw’; nested exception is java.lang.NumberFormatException: For input string: “fw”
1.遇到一个这样的问题: 往后台传一个字符串的值,到后台接收参数时报错 Failed to convert from type [java.lang.String] to type [java.lang.Long]; 大概代码如下
原因(猜测): 传递的是cookie,且接收的是cookie类里面的字段cookie,所以接收时分辨不出来?
解决: 把cookie类的字段cookie改成其它(value),前台也传value:xxx ,就可以…