https://github.com/2026-source-code/servlet-product-exam.git

post 바디 헤더 구조

image.png

image.png

Screenshot_9.png

상품목록, 삭제, 등록 **(수정, 상세보기는 안함)**

1. 서버구조

1. if로 구현된 DispatcherServlet, *.do 주소 매핑
2. mustache -> 상품등록페이지, 상품목록(상품삭제) 상품수정페이지
3. 제일 기본 JDBC로 연결 (DBConnection)

2. 요청흐름 (MVC 이해)

DS -> ProductController -> ProductService -> ProductRepository

예외전담 클래스(RuntimeException)

모든 요청은 DispatcherServlet 통해서 요청

1. 상품목록 페이지 요청 -> DS -> forward -> list.mustache
2. 상품 목록 페이지 상단에 상품 등록 버튼 클릭 (a태그) -> DS -> forward -> save-form.mustache
3. 상품등록 페이지에서 form(post)요청 -> ds -> 상품 등록 후 상품 목록으로 redirect
4. 상품목록 삭제 버튼 클릭 form(post)요청 -> ds -> 상품 삭제 후 -> 상품목록으로 redirect

3. 무엇을 이해하는가?

https://github.com/2026-source-code/servlet-product-exam/blob/master/.context/diagrams.md

1. request객체, response객체
2. redriect (302) header 와 response.sendRedirect() 재요청
3. forward 내부이동
4. queryString, x-www-form-urlencoded
5. 상태코드(100~500)
6. 예외처리 응답(try-catch 잡는 클래스 생성)
7. Content-Type, MIME
8. stateless

image.png