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

Slides:



Advertisements
Similar presentations
Java Servlet & JSP © copyright 2005 SNU OOPSLA Lab.
Advertisements

Objectives Ch. D - 1 At the end of this chapter students will: Know the general architecture and purpose of servlets Understand how to create a basic servlet.
Servlets Stoney Jackson
10-Jun-15 Servlets. 2 Servers A server is a computer that responds to requests from a client Typical requests: provide a web page, upload or download.
An introduction to Java Servlet Programming
Servlets. A form The HTML source Chapter 1 Please enter your name and password then press start Name: Password: In Netbeans you can graphically create.
2/16/2004 Dynamic Content February 16, /16/2004 Assignments Due – Message of the Day Part 1 Due – Reading and Warmup Work on Message of the Day.
1 CS6320 – Servlet Structure and Lifecycle L. Grewe.
Web programming for project students Dr Jim Briggs.
Servlets Compiled by Dr. Billy B. L. Lim. Servlets Servlets are Java programs which are invoked to service client requests on a Web server. Servlets extend.
Servlets. Our Project 3-tier application Develop our own multi-threaded server Socket level communication.
Michael Brockway Application Integration Servlets l Introduction & Overview l HTTP Servlets l HTTP get Requests l HTTP post Requests l Multi-tier Applications.
A Servlet’s Job Read explicit data sent by client (form data) Read implicit data sent by client (request headers) Generate the results Send the explicit.
Java Servlets and JSP.
Java Servlets.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
Java Servlet Technology. Introduction Servlets are Java programs that run on a Web server, handle HTTP requests and build Web pages Servlet specification.
Servlets By B. Venkateswarlu M.Tech Assoc Prof IT(Dept) Newton’s Institute of Engineering By B. Venkateswarlu M.Tech Assoc Prof IT(Dept) Newton’s Institute.
Servlets. - Java technology for Common Gateway Interface (CGI) programming. - It is a Java class that dynamically extends the function of a web server.
Objectives Java Servlet Web Components
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
CSC 2720 Building Web Applications
Chapter 5 Java Servlets. Objectives Explain the nature of a servlet and its operation Use the appropriate servlet methods in a web application Code the.
J2EE training: 1 Course Material Usage Rules PowerPoint slides for use only in full-semester, for-credit courses at degree-granting.
111 Java Servlets Dynamic Web Pages (Program Files) Servlets versus Java Server Pages Implementing Servlets Example: F15 Warranty Registration Tomcat Configuration.
CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta CMPUT 391 Database Management Systems Web based Applications,
Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.
Servlet Lifecycle Lec 28. Servlet Life Cycle  Initialize  Service  Destroy Time.
Java Servlets Outline 24.1 Introduction 24.2 Servlet Overview and Architecture Interface Servlet and the Servlet Life Cycle HttpServlet Class.
The Simplest Possible Tool - Iteration 1 Vancouver Bootcamp Mike Osterman
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
A seminar on j2ee by saritha. s. What is J2EE J2EE (Java 2 Platform, Enterprise Edition) is a Java platform designed for the mainframe-scale computing.
Java Servlet API CGI / HTTP Concepts Java Servlet API.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Session II: Introduction to Server-Side Web Development with Servlets.
® IBM Software Group © 2007 IBM Corporation Servlet Filtering
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 24: Servlets Outline 24.1 Introduction 24.2 Servlet Overview and Architecture Interface.
Servlets.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, Responds oriented other.
1 Introduction to Servlets. Topics Web Applications and the Java Server. HTTP protocol. Servlets 2.
Advanced Java Session 6 New York University School of Continuing and Professional Studies.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
J2EE T ECHNOLOGIES These are the technologies required to build large scale distributed applications, can be divided into – Component Technologies eg.
Advanced Java Session 6 New York University School of Continuing and Professional Studies.
Configuration Web Server Tomcat - Install JDK Install Tom cat Configure Tom cat for running Servlet C:\Program Files\Apache Software Foundation\Tomcat.
Java and the Web CSE 3330 Southern Methodist University.
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
Java Web Applications. WAR Web Archive Introduced with servlet 2.2 specification Portable deployment mechanism for web applications Defines directory.
 2003 Prentice Hall, Inc. All rights reserved Deploying a Web Application ( may include.war )
Chapter 4 Request and Response. Servlets are controlled by the container.
1 Lecture 8 George Koutsogiannakis/Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
1 Web Programming with Servlets & JSPs WEB APPLICATIONS – AN OVERVIEW.
CS320 Web and Internet Programming Introduction to Java Servlets Chengyu Sun California State University, Los Angeles.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Introduction to Servlets
CS3220 Web and Internet Programming Introduction to Java Servlets
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
Net-centric Computing
Course Outcomes of Advanced Java Programming AJP (17625, C603)
Servlets and Java Server Pages
Servlets and JSP 20-Nov-18 servletsJSP.ppt.
Servlets.
Servlet APIs Every servlet must implement javax.servlet.Servlet interface Most servlets implement the interface by extending one of these classes javax.servlet.GenericServlet.
Java Servlets and JSP.
CS3220 Web and Internet Programming Introduction to Java Servlets
Introduction to Java Servlets
Presentation transcript:

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

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

Web Application Technologies

Client-Server Architecture

HTTP C-S Architecture

CGI Programs on the Web Server

기존 CGI Programs

Servlets on the Web Server

Servlet Program

The Model2 Architecture

J2EE Architecture

Web Application Migration

Servlet Engine

Servlet Server Programs  JDK 설치  JAVA_HOME=C:\J2SDK1.X  Path=.;%JAVA_HOME\bin  classpath=.;C:\....\X.jar  Servlet Server  TOMCAT(  RESIN(  Home 경로 추가  servlet.jar 경로 classpath 에 추가

TOMCAT ./Tomcat/bin\startup.bat

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

Resin ./resin\bin/httpd.exe

Resin

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

Simple Servlet

The NetServer Architecture

The Generic Servlet API

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(); }

Hypertext Transfer Protocol

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

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

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

Web Container Architecture

SequenceDiagram - HTTP GetRequest

The Http Servlet API

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(); }

Servlet Life Cycle

Servlet / HTML Form

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

HTML Form Components

Servlet API

Deployment Descriptor

 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

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

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);.. }

Servlet Config

Servlet Context

MVC Parrern

Cookie / Session

Error Handling