PrintWriter out=response.getWriter();
먼저 위의 response는 서버가 클라이언트에게 '응답'한다는 의미를 가진 객체.
서버가 클라이언트에게 '응답'하려면 무조건 response라는 객체를 통해 작업을 해야함.
여기서 getWriter()는 '쓰기'를 통해 응답하겠다는 메서드. 데이터타입은 PrintWriter.
out.print("<html>");
위에서 out이라는 객체가 생성되었으므로 out.print();를 통해 html페이지에 원하는 결과를 출력할 수 있습니다.
서버에서 클라이언트에게 응답할 장소는 html페이지 이기 때문에 <html><body>...</body></html>형식을 지켜줘야합니다. 그래서 위와 같이 큰따옴표("")안에 html태그를 넣었습니다.
'TIL > Learn - JSP' 카테고리의 다른 글
mvc2 FrontController mapping (0) | 2019.09.17 |
---|---|
MVC 1 (0) | 2019.09.09 |
response.setContentType("text/html; charset=UTF-8"); (0) | 2019.09.04 |
comment