나는 Spring MVC - Hibernate 애플리케이션을 here으로 개발했다.Spring MVC에서 Spring REST 튜토리얼 오해에 대해서
이제이 코드를 수정하여 here과 같이 REST 응용 프로그램을 만들려고합니다.
클래스 경로에 Jackson
라이브러리를 추가했으며 @XmlRootElement
을 추가했습니다. 나는 application/json
요청을 할 경우
@XmlRootElement(name = "persons")
public class Person implements Serializable {
하지만 난 여전히 html
코드를 다시 얻을.
내가 뭘 잘못하고 있었는지/잊어 버렸습니까?
내 컨트롤러 :
@RequestMapping(value = "/persons", method = RequestMethod.GET)
@ResponseBody
public String getPersons(Model model) {
logger.info("Received request to show all persons");
// Retrieve all persons by delegating the call to PersonService
List<Person> persons = personService.getAll();
model.addAttribute("persons", persons);
return "personspage";
}
는 컨트롤러가 변경되었지만 오류가 발생합니다 :
ype Status report
message /Buddies/WEB-INF/jsp/main/persons/1.jsp
description The requested resource (/Buddies/WEB-INF/jsp/main/persons/1.jsp) is not available.
컨트롤러 방법을 알려주세요. 당신의 메소드에서'Person' 객체를 리턴하고'@ ResponseBody' 주석을 컨트롤러 메소드에도 가지고 있습니까? –
나는 (내가 @PathVariable 추가했지만 오류, 해당 유형 상태 보고서 메시지 /Buddies/WEB-INF/jsp/main/persons/1.jsp 설명을 요청한 리소스를 얻을 수있다 그것을 –