1. Form GET
❓ form tag에 method가 없으면?





❗ 기본적으로 form tag의 method는 “GET” 요청
→ update는 “POST” 요청이므로 form tag에 method=post를 써줘야 한다
2. input tag name 값
❓ input tag의 name 값이 아예 없거나 오타가 있다면?





❗ URL Parameter 이름이 “price”일 때 method에서 price 변수에 받는데, input tag의 name값은 없으므로 오류가 발생한다
3. RequestParam 값
📌 @RequestParam
vs @PathVariable
어노테이션 | 데이터 위치 | 예제 URL | 메서드 예제 |
@RequestParam | 쿼리 스트링 | /user?name=John | @RequestParam String name |
@PathVariable | URL 경로 변수 | /user/John | @PathVariable String name |
❓ 값에 오타가 있으면?


❗ URL Parameter 이름이 “prlce”일 때 method에서 price 변수에 받는데, input tag의 name값은 “price”이므로 오류가 발생한다
❓ RequestParam의 값이 아예 없으면?


❗ price 변수에 받을 URL Parameter가 없어서 오류 발생
4. Transactoinal



Share article