Spring Boot:为HTTP路径“ http:// localhost:8080 / error”映射的模糊处理程序方法

时间:2018-12-20 02:05:36

标签: ajax spring spring-boot

每次我使用ajax进行发布时,都会遇到此错误,但是数据传递可以成功进行。有人说这是因为我的回国声明。我也没有针对/ error的任何映射。这是导致此错误的我的工作之一。

AJAX:

$.ajax
({
type: 'post',
url: '/SaveDependent',
data: 
{
    dependent_id: 0,
    reference_no: referenceNo,
    dependent_name: dNameValue[i],
    dependent_dob: dDobValue[i],
    dependent_gender: dGenderValue[i],
    dependent_occupation: dOccupationValue[i],
    dependent_relationship: dRelationshipValue[i],
    dependent_beneficiary: dBeneficiaryValue[i]
},
success: function (response) 
{
    alert("success");
},
});

控制器:

@RequestMapping(value= "/SaveDependent", method=RequestMethod.POST)
public String saveDependent(ClientApplicationDependent clientApplicationDependent) {
        clientApplicationDependentService.saveOrUpdate(clientApplicationDependent);
        return "success";
}

服务:

public interface ClientApplicationDependentService {
    public void saveOrUpdate(ClientApplicationDependent clientApplicationDependent);
}

SERVICE IMPL:

@Override
public void saveOrUpdate(ClientApplicationDependent clientApplicationDependent) {
    clientApplicationDependentRepository.save(clientApplicationDependent);
}

0 个答案:

没有答案