我试图用PUT从JavaScript将参数传递给Spring应用程序。这里是一个春天控制器的@RequestMapping:Spring和ExtJS的“400错误的请求”与PUT但与POST
@RequestMapping(value = "toggle-paid-action", method = RequestMethod.PUT)
@ResponseBody
public final String togglePaid(@RequestParam final int year,
@RequestParam final String docType, @RequestParam final int number) {
这里是应该发送这些参数的JavaScript代码段。
Ext.Ajax.request({
params: {year: year, docType: docType, number: number},
url: 'toggle-paid-action',
method: 'PUT',
不过,我得到一个“400错误的请求”与描述,每次“客户端发送的请求是语法不正确的()”。
如果我使用Firebug检查,有一个与我的所有参数的PUT选项卡和参数的拼写正确,因为如果我从PUT切换到职位上双方一切正常。
我想知道什么可能是这个问题,放在仅限于@PathVariable参数,也可以发送POST也类似参数?
你检查,[这个问题](http://stackoverflow.com/questions/5521173/spring-framework-enable-put-method)?它建议使用'String'或模型类而不是'int/Integer'和一些关于默认方法的信息。 – sjngm