SpringMVC is not recognizing request body parameters if using PUT

后端 未结 4 1111
我在风中等你
我在风中等你 2020-12-04 16:50

Maybe this is supposed to not work, but at least I\'d like to understand why then. I am passing a simple val=somevalue in the PUT body but spring sends back a <

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 17:27

    I don't have right solution for you, but in your case I try following:

    • create page with form:form method="PUT"
    • declare HiddenHttpMethodFilter in web.xml

    If this will works, then

    • change type from PUT to POST in ajax call
    • add needed params which client has with form:form tag (something like _method)

    In other words, as I understand Spring emulates PUT based on simple POST with special parameter. Just send to him what he wants.

    See also: http://stsmedia.net/spring-finance-part-2-spring-mvc-spring-30-rest-integration/ and related code examples there: http://code.google.com/p/spring-finance-manager/source/browse

    HTH

提交回复
热议问题