Replies: 1 comment
|
오 ? 보민님 굳입니다. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
✏️ HTTP 요청 데이터 - GET 쿼리 파라미터
&로 구분한다.http://localhost:8080/request-param?username=hello&age=20HttpServletRequest가 제공하는 다음 메서드를 통해서 쿼리 파라미터를 편리하게 조회할 수 있다.RequestParamServlet실행 - 파라미터 전송
http://localhost:8080/request-param?username=hello&age=20결과

실행 - 동일 파라미터 전송
http://localhost:8080/request-param?username=hello&username=kim&age=20결과

📍 복수 파라미터에서 단일 파라미터 조회
✏️ HTTP 요청 데이터 - POST HTML Form
HTML의 Form을 사용하여 클라이언트에서 서버로 데이터를 전송하자.
특징
application/x-www-form-urlencodedusername=hello&age=20src/main/webapp/basic/hello-form.html실행했을 때의 화면

POST의 HTML Form을 전송하면 웹 브라우저는 다음 형식으로 HTTP 메시지를 만든다.
application/x-www-form-urlencodedusername=hello&age=20request.getParameter()는 GET URL 쿼리 파라미터 형식도 지원하고 POST HTML Form 형식도 둘 다 지원한다.📍 참고
✏️ HTTP 요청 데이터 - API 메시지 바디 - 단순 텍스트
-RequestBodyStringServlet
📍 참고
✏️ HTTP 요청 데이터 - API 메시지 바디 - JSON
JSON 형식으로 전송
{"username" : "hello" , "age": 20}message body :{"username" : "hello" , "age": 20}`hello.servlet.basic.HelloDatahello.servlet.basic.request.RequestBodyJsonServlet{"username" : "hello", "age":20}📍 참고
✏️ HttpServletResponse - 기본 사용법
🔍 HttpServletResponse 역할
🔍 HttpServletResponse - 기본 사용법
hello.servlet.basic.response.ResponseHeaderServlet✏️ HTTP 응답 데이터 - 단순 텍스트, HTML
HTTP 응답 메시지는 주로 아래의 내용을 담아서 전달한다.
`hello.servlet.basic.response.ResponseHtmlServlet
text/html로 지정해야 한다.✏️ HTTP 응답 데이터 - API JSON
📍 참고
🔗출처
All reactions