스프링 오류

경고 메시지 내용(sts 콘솔창)

WARN : org.springframework.web.servlet.PageNotFound - No mapping for GET /spring/board/list


원인

 1. 해당 URI를 처리하는 메소드를 생성 안한 경우

 2. 해당 URI를 처리하는 메소드를 만들었지만 해당 클래스에 @Controller 어노테이션을 안 쓴경우


해결

 1. 컨트롤러에 해당 URI를 처리하는 메소드를 생성

1
2
3
4
5
6
7
8
9
@Controller
public class BoardController {
    @RequestMapping(value = "/board/list", method = RequestMethod.GET)
    public ModelAndView boardListGet(ModelAndView mv) {
        mv.setViewName("/board/list");
        //기능 코드는 생략
        return mv;
    }
}

cs


2. 컨트롤러에 @Controller 어노테이션을 추가

1
2
3
4
@Controller
public class BoardController {
    //... 컨트롤러 안 메소드 생략
}
cs


+ Recent posts