解雇ajax时400 Bad Request

时间:2014-02-20 10:47:02

标签: ajax spring annotations

在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);
    }
}

0 个答案:

没有答案