Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 자바
- 인프런
- QueryDSL
- AOP
- Exception
- Proxy
- transaction
- 스프링
- http
- kotlin
- Servlet
- pointcut
- SpringBoot
- springdatajpa
- 스프링 핵심 원리
- 스프링 핵심 기능
- JDBC
- JPQL
- jpa
- Spring Boot
- 김영한
- Android
- 그리디
- 백준
- Greedy
- Thymeleaf
- spring
- 알고리즘
- db
- java
Archives
- Today
- Total
개발자되기 프로젝트
HTTP 응답 데이터 - 단순 텍스트, HTML 본문
1. HTTP 응답 메시지는 주로 아래 내용을 담아서 전달됨.
- 단순 텍스트 응답
- writer.println("ok");
- HTML 응답
- HTTP API - MessageBody JSON 응답
2. HttpServletResponse - HTML 응답
- content-type : text/html
@WebServlet(name = "ResponseHtmlServlet", urlPatterns = "/response-html")
public class ResponseHtmlServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Content-Type: text/html;charset=utf-8
response.setContentType("text/html");
response.setCharacterEncoding("utf-8");
PrintWriter writer = response.getWriter();
writer.println("<html>");
writer.println("<body>");
writer.println(" <div>안녕</div>");
writer.println("</body>");
writer.println("</html>");
}
}
3. GitHub : 210908 HttpServletResponse, html
GitHub - bsh6463/MVC1
Contribute to bsh6463/MVC1 development by creating an account on GitHub.
github.com
'인프런 > [인프런] 스프링 MVC 1' 카테고리의 다른 글
[Servlet] 회원 관리 웹 애플리케이션 요구사항 (0) | 2021.09.09 |
---|---|
HTTP 응답 데이터 - API JSON (0) | 2021.09.08 |
HttpServletResponse - 기본 사용법 (0) | 2021.09.08 |
HTTP 요청 데이터 - API 메시지 바디 - JSON (0) | 2021.09.08 |
HTTP 요청 데이터 - API 메시지 바디 - 단순 텍스트 (0) | 2021.09.08 |
Comments