[Spring] Thymeleaf로 put method 보내기

nathan·2022년 3월 12일
0

Spring

목록 보기
2/4

🤔 Thymeleaf로 (유저)수정 기능을 구현할 때 생긴 문제점

  • @PutMapping으로 URL을 매핑하기 위해 html에서 해준 작업들
    • form 태그 속성 method="post"
    • input 태그 속성 type="hidden", name="_method", value="put"
  • 원래는 위와 같이 하면 바로 되어야 하지만, 아래의 예외가 자꾸 발생됐다.
  • DefaultHandlerExceptionResolver : Resolved [org.springframework.web.HttpRequestMethodNotSupportedException: Request method 'POST' not supported]```
  • 결론적으로 말하자면, properies에 hiddenmethod에 대한 설정을 추가해야 했다.
    spring.mvc.hiddenmethod.filter.enabled=true
profile
나는 날마다 모든 면에서 점점 더 나아지고 있다.

0개의 댓글