【发布时间】:2019-03-07 16:15:47
【问题描述】:
我正在向 spring mvc 处理程序发送 ajax get 请求,我可以传递参数值。 问题是,我每次都变成错误:
spring.interceptor.ParamsInterceptor - 请求前: org.springframework.beans.NotWritablePropertyException:无效 bean 类的属性“fromDate” [com.example.CallDbController]:豆 属性“fromDate”不可写或设置方法无效。 setter 的参数类型是否与 setter 的返回类型匹配 吸气剂? [spring-beans-4.2.4.RELEASE.jar:4.2.4.RELEASE]
我的 Ajax 请求:
$.ajax({
type : "GET",
url : 'myUrl.action',
data : {
"fromDate" : start
},
success : function(msg) {
console.log('something to do...');
}
});
和我的控制器处理程序:
@Controller
@RequestMapping("/calldb/*")
public class CallDbController {
@RequestMapping(value = { "myUrl.action" }, method = RequestMethod.GET)
public @ResponseBody String[] getTimeDifference(@RequestParam("fromDate") String startDate) {
//something to do...
}
}
我很困惑,来自 GET-Request 的“fromDate”请求参数 被解释为 Bean-Property。
【问题讨论】:
标签: ajax spring-mvc get-request