Today Yewon Learned

[Spring] Request method 'POST' not supported 오류 해결 본문

Spring

[Spring] Request method 'POST' not supported 오류 해결

데브워니 2022. 7. 4. 13:02

Ajax통신을 통해 POST방식으로 데이터를 보내기를 시도하였으나, 아래와 같은 오류가 발생했다.

Handler execution resulted in exception - 
forwarding to resolved error view: ModelAndView: reference to view with name 'cmmn/egovError';
model is {exception=org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported}

POST 방식을 지원하지 않는다는 의미이다.

 

해당 url을 매핑하는 @RequestMapping을 확인하니, RequestMethod.GET 방식으로 되어 있었다.

@RequestMapping(value="test.do", method = {RequestMethod.GET})

 

RequestMethod.POST 을 추가해주면 오류 해결이 된다.

@RequestMapping(value="test.do", method = {RequestMethod.GET, RequestMethod.POST})

'Spring' 카테고리의 다른 글

[Spring] MVC (Model-View-Controller) Pattern  (0) 2021.11.25
[Spring] @RequestMapping의 GET/POST 요청  (0) 2021.11.19
[Spring] Spring Annotation  (0) 2021.11.09
Comments