在ftl文件中,我在解释ajax的时候有这样的ajax,我得到404 Not found错误,虽然一切都很好,
$.CustomService.execute("/policyDetails/"+$(this).attr('data-cancel-id')+"/policyList.json", {
method : "GET",
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
success : function(response) {
alert("Success");
console.log(response);
},
error : function() {
alert("Error");
}
});
在控制器
中@Controller
@RequestMapping("/cancellationPolicyDetails")
{
..........
..........
@RequestMapping(value = "/{id}/policyList", method = RequestMethod.GET, produces = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE})
@ResponseBody
public CancellationPolicyDetailDTO getDetails(@PathVariable Long id) {
return this.service.findOne(id);
}
}