【问题标题】:Spring ParamsInterceptor complains about @RequestParam- BEFORE REQUESTSpring ParamsInterceptor 抱怨 @RequestParam- BEFORE REQUEST
【发布时间】: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


    【解决方案1】:

    我找到了我的问题。由于某些拦截器的实现而引发了异常。

    【讨论】:

      猜你喜欢
      • 2019-12-20
      • 1970-01-01
      • 2015-12-22
      • 2022-01-10
      • 2012-01-28
      • 2011-11-14
      • 2014-06-27
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多