공부하는가비
2021.05.11 Servlet 본문
서블릿의 실행
Servlet (I,F) => GenericServlet => HttpServlet
Init -> service -> destroy
client -> sever(apache) -> container (tomcat) -> init()
-> service(request, response)
: doPost, doGet
요청정보
헤더 : GET a.html HTTP/1.1
name=hong&age=20
바디 :
헤더 : POST a.html HTTP/1.1
바디 : name=hong&age=20
GET
<form action='addInfo' method='GET'>
<input name='name' value = 'hong'>
<input name='age' value= 20>
<input type='submit'>
</form>
<a href='addInfo?name=hong&age=20'> get 방식요청
헤더 : GET a.html HTTP/1.1
name=hong&age=20
바디 :
POST
<form action='addInfo' method='post'>
<input name='name' value = 'hong'>
<input name='age' value= 20>
<input type='submit'>
</form>
헤더 : GET a.html HTTP/1.1
바디 : name=hong&age=20
인코딩 해 주어야한다
get방식은 head에 있는 값을 읽어오는것이라 아래 처럼만 해주면된다
Post 방식은 body에 있는 값을 읽어오는것이므로
'개발 > JSP' 카테고리의 다른 글
2021.05.13 Servlet RequestDispatcher (0) | 2021.05.13 |
---|---|
2021.05.12 Servlet 자바의 변수 (멤버변수/지역변수) (0) | 2021.05.12 |