Presentation is loading. Please wait.

Presentation is loading. Please wait.

Servlet / JSP 전 혜 영전 혜 영 전 혜 영전 혜 영. 0. 목차  Web Application Technologies  Servlet Server  Simple Servlet  Servlet / HTML Form  Deployment Descriptor.

Similar presentations


Presentation on theme: "Servlet / JSP 전 혜 영전 혜 영 전 혜 영전 혜 영. 0. 목차  Web Application Technologies  Servlet Server  Simple Servlet  Servlet / HTML Form  Deployment Descriptor."— Presentation transcript:

1 Servlet / JSP 전 혜 영전 혜 영 전 혜 영전 혜 영

2 0. 목차  Web Application Technologies  Servlet Server  Simple Servlet  Servlet / HTML Form  Deployment Descriptor  Servlet Context  MVC Parrern  Cookie / Session  Error Handling

3 Web Application Technologies

4 Client-Server Architecture

5 HTTP C-S Architecture

6 CGI Programs on the Web Server

7 기존 CGI Programs

8 Servlets on the Web Server

9 Servlet Program

10 The Model2 Architecture

11 J2EE Architecture

12 Web Application Migration

13 Servlet Engine

14 Servlet Server Programs  JDK 설치  JAVA_HOME=C:\J2SDK1.X  Path=.;%JAVA_HOME\bin  classpath=.;C:\....\X.jar  Servlet Server  TOMCAT(http://jakarta.apache.org)  RESIN(http://www.caucho.com)http://www.caucho.com  Home 경로 추가  servlet.jar 경로 classpath 에 추가

15 TOMCAT ./Tomcat/bin\startup.bat

16 TOMCAT Configuration  Tomcat  bin  startup.bat, shutdown.bat  conf  server.xml, web.xml  webapps  ROOT  WEB-INF  Classes  web.xml  html, jsp  work

17 Resin ./resin\bin/httpd.exe

18 Resin

19 Resin Configuration  bin  httpd.exe  conf  resin.conf, app-default.xml  doc  WEB-INF  classes  work  html, jsp  lib  resin.jar  webapps  config.xml

20 Simple Servlet

21 The NetServer Architecture

22 The Generic Servlet API

23 Generic Servlet Code import javax.servlet.GenericServlet; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import java.io.PrintWriter; import java.io.IOException; public class HelloServlet extends GenericServlet { public void service(ServletRequest request, ServletResponse response) throws IOException { PrintWriter out = response.getWriter(); out.println(“Hello, World!!”); out.close(); }

24 Hypertext Transfer Protocol

25 HTTP (Hypertext Transfer Protocol)  request/reponse  header  entity body  HTTP 동작 방식  GET  POST  HEAD  PUT  DELETE  TRACE  OPTIONS

26 GET url HTTP/1.1 요청에 대한 정보 GET/POST Request POST url HTTP/1.1 요청에 대한 정보 요청의 일부로 전송되는 정보

27  GET  소량의 데이타 전송  HTTP 의 헤더로 데이타 전송  URL 창에 보내는 데이타가 보임  URL 창에 http://www.babo.com 이라고 요청하 는 것 자체가 GET 방식 ( default )http://www.babo.com  POST  HTTP 의 몸체로 데이타 전송  대량의 데이타 ( 예, 파일전송 ) 전송시  URL 창에 데이타가 안보이기에 보안에 좋음

28 Web Container Architecture

29 SequenceDiagram - HTTP GetRequest

30 The Http Servlet API

31 HttpServlet Code import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.PrintWriter; import java.io.IOException; public class HelloServlet extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { response.setContentType("text/html;charset=euc-kr"); PrintWriter out = response.getWriter(); out.println(" "); out.println(" "); out.println(" Hello Servlet "); out.println(" "); out.println(" Hello, World "); out.println(" "); out.println(" "); out.close(); }

32 Servlet Life Cycle

33 Servlet / HTML Form

34 FORM tag  action : 웹 서버에 전달되어 처리될 CGI 프로 그램 주소  method : get/post  enctype : 인코딩 타입  target : CGI 프로그램이 처리후 결과를 보여 줄 위치

35 HTML Form Components

36 Servlet API

37 Deployment Descriptor

38  web-app  icon  display-name  description  distributable  context-param  filter  filter-mapping  listener  servlet  servlet-mapping  session-config  mime-mapping  welcome-file-list  error-page  taglib  resource-env-ref  resource-ref  security-constraint  login-config  security-role  env-entry  ejb-ref  ejb-local-ref  Filter  icon  filter-name  display-name  description  filter-class  init-param  param-name  param-value  description  filter-mapping  filter-name  url-parrern  servlet-name  servlet  icon  servlet-name  display-name  description  servlet-class  jsp-file  init-param  param-name  param-value  servlet-mapping  servlet-name  url-pattern

39 Initialization Parameters (web.xml) simpleServlet ServletTest dbDriver com.mysql.jdbc.Driver

40 Initialization Parameters (servlet.java) public class ServletTest extends HttpServlet{ private String driver; public void init(){ Driver=getInitParameter(“dbDriver”); } public void doGet(HttpServletRequest, httpServletResponse) throws ServletException, IOException{ … Out.println(driver);.. }

41 Servlet Config

42 Servlet Context

43 MVC Parrern

44 Cookie / Session

45 Error Handling


Download ppt "Servlet / JSP 전 혜 영전 혜 영 전 혜 영전 혜 영. 0. 목차  Web Application Technologies  Servlet Server  Simple Servlet  Servlet / HTML Form  Deployment Descriptor."

Similar presentations


Ads by Google