这是我的代码,我使用的是angular和spring mvc。请告诉我怎么走
vm.upload= function(state_cd){
fd= new FormData();
fd.append("mst.distCd", dist_cd);
call(fd);
});
}
function call(fd){
$http({
type: "POST",
url: "./WQF00069/update.app",
data: fd,
processData: false,
headers: { 'Content-Type': undefined},
transformRequest: angular.identity,
cache: false,
timeout: 600000,
}).success(function(data) {
Flash.create('info', ' Update Success Fully ', 'large-text');
}).error(function(response){
console.dir(response);
Flash.create('danger','There is a Problem.Contact With Administrator', 'large-text');
});
}发送到我的控制器后,获取415错误
发布于 2019-11-05 13:47:51
如果spring控制器只接受内容类型'application/json',那么就不可能通过这种方式发送数据。更改控制器以接受表单数据。如果请求参数中有@RequestBody,则将其删除。像这样的实现可能会起作用:
@RequestMapping(value = "/endpoint1", method = RequestMethod.POST)
public void endpoint1()
{
//...
}https://stackoverflow.com/questions/58704897
复制相似问题