본문 바로가기

web/Spring

RestAPI와 form

form의 action 속성에 값을 안주면(<form action method="post></form>)현재 url에 요청을 보낸다

이걸 이용해서

 

get은 form이 있는 페이지로 이동하게 만들고 @GetMapping("/sameurl")

form action method="post" 로다가 깔쌈한 구조 설계 가능 @PostMapping("/sameurl")

 

<form action="임시페이지"  th:action> 이런식으로 임시페이지는 개발때만쓰고 실운영시에는 자기경로 RESTAPI로 타임리프 응용도 가능