저는 angularJS를 새로 도입했습니다. 나는 등록 업무를 만들고있다. 여기에 개별 속성을 보내는 경우. 점점 성공 메시지. 하지만 json으로 객체를 보내려고합니다. 가져 오기 리소스를로드하지 못했습니다. 서버가 404 상태로 응답했습니다. (찾을 수 없음)
하지만 오류가 아래 점점Failed to load resource: the server responded with a status of 404 (Not Found)
클라이언트 측 코드
function registration(user) {
var employee={
name:user.firstName+" "+user.lastName,
email:user.emailAddress,
password:user.password
};
var data = JSON.stringify(employee);
$http.post('http://localhost:8080/AngularJSSpring/ajax/register', data
).success(
function(data, status) {
defer.resolve(data);
});
return defer.promise;
}
서버 측 코드 나 또한
$http.post('http://localhost:8080/AngularJSSpring/ajax/register', employee)
를 개질시키기에 의해 시도 (스프링 MVC)
@RequestMapping(value = "/ajax/register", method = RequestMethod.POST,consumes=MediaType.APPLICATION_JSON_VALUE)
@ResponseBody
public JSONResponse registration(@RequestBody Employee emp) {
System.out.println("ajax register");
return angularView.registration(emp);
}
하지만 작업 ... 봄을 가진 것은이이
을하는 데 도움이됩니다. 클라이언트 측 (각도)이 아닙니다. 나는 너를 위해 그것을 테스트 할 수 없다. 너 url을 확인 했니? 예를 들어 REST 클라이언트 사용. – AxelH
해결 !!!. 실제로 서버 측에서 문제가 발생했습니다. "@RequestBody Employee emp"가 작동하지 않습니다. 나는 개체를 String으로 변경 한 다음 json을 Object로 변환했다. – Musaddique
마찬가지로, 서버 문제. Spring이 어떻게 동작 하는지를 확인해야한다. 왜냐하면 Spring을 사용하기 때문이다. – AxelH