[Handler] Throwable Error!!! uri: {호출한 URI}, trace: org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
개요 : 단순 form 에 데이터 넣고 submit 때린 것 밖에 없는데.. 왜 받질 못하니 😭
<form id="testForm" name="testForm" method="post" action="{호출할 URI}">
<input...>
<input...>
</form>
@PostMapping("/{호출할 URI}")
@ResponseBody
public Object myTestMethod(@RequestBody TestModel testModel) {
// 수행코드
}
원인 : 다른 POST 통신할 때와 동일하게 모델을 @RequestBody 로 받으려고했기 때문..
@RequestBody : body 에 있는 json 데이터를 파싱해줌
해결 : @ModelAttribute 로 모델을 받으니까 잘 된다..ㅠ_ㅠ
😓 머쓱머쓱.. 똑똑한 Spring.. 엉뚱한 Annotation 쓰지말고 잘 알고, 잘 맞게 Annotation 을 사용하자.
반응형
'Error' 카테고리의 다른 글
[R] R Console 에서 엑셀데이터 읽기 실패 (library(xlsx) 로드 실패) (2) | 2020.05.24 |
---|---|
[ERROR] org.apache.ibatis.binding.BindingException: Invalid bound statement (not found) (0) | 2020.04.06 |
[MyBatis] there is no getter for property named 에러 (0) | 2020.02.11 |
[Java] java.io.FileNotFoundException '파일경로' (No such file or directory) (0) | 2020.01.28 |
[Mybatis] insert 시 unsupported return type 에러 해결방법 (0) | 2020.01.08 |
댓글