J2EE Lecture 1:Servlet and JSP

Slides:



Advertisements
Similar presentations
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Servlets and Java Server Pages.
Advertisements

 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
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.
MC365 Application Servers: Servlets. Today We Will Cover: What a servlet is The HTTPServlet and some of its more important methods How to configure the.
Servlets and a little bit of Web Services Russell Beale.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
Introduction to Servlet & JSP
Creating your website Using Plain HTML. What is HTML? ► Web pages are authored in HyperText Markup Language (HTML) ► Plain text is marked up with tags,
JavaServer Pages TM Introduce by
Session-01. What is a Servlet? Servlet can be described in many ways, depending on the context: 1.Servlet is a technology i.e. used to create web application.
Chapter 4 Servlets Concept of Servlets (What, Why, and How) Servlet API Third-party tools to run servlets Examples of Using Servlets HTML tag with GET.
Definition Servlet: Servlet is a java class which extends the functionality of web server by dynamically generating web pages. Web server: It is a server.
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.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
Java Servlets. What Are Servlets? Basically, a java program that runs on the server Basically, a java program that runs on the server Creates dynamic.
Gayle J Yaverbaum, PhD Professor of Information Systems Penn State Harrisburg.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 37 - JavaServer Pages (JSP): Bonus for Java Developers Outline 37.1 Introduction 37.2 JavaServer.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
J2EE Web Fundamentals Lesson 1 Introduction and Overview
11. Java-Based Web: JSP, JSF. 2 Motto: Rule 1: Our client is always right Rule 2: If you think our client is wrong, see Rule 1. - Anonymous.
Java Omar Rana University of South Asia. Course Overview JAVA  C/C++ and JAVA Comparison  OOP in JAVA  Exception Handling  Streams  Graphics User.
 2005 Pearson Education, Inc. All rights reserved Servlets.
1 Chapter 2 The Web Tier  Web Applications and Web ContainersWeb Applications and Web Containers  Dynamic Content CreationDynamic Content Creation 
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
Objectives Java Servlet Web Components
Java support for WWW Babak Esfandiari (sources: Qusay Mahmoud, Roger Impey, textbook)
COMP 321 Week 7. Overview HTML and HTTP Basics Dynamic Web Content ServletsMVC Tomcat in Eclipse Demonstration Lab 7-1 Introduction.
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.
Java Servlets & Java Server Pages Lecture July 2013.
Java Servlets Lec 27. Creating a Simple Web Application in Tomcat.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Chapter 2 Web app architecture. High-level web app architecture  When a client request coming in and needs servlet to serve dynamic web content, what.
20-Nov-15introServlets.ppt Intro to servlets. 20-Nov-15introServlets.ppt typical web page – source Hello Hello.
Java Servlet API CGI / HTTP Concepts Java Servlet API.
@2008 Huynh Ngoc Tin Chapter #2 JAVA SERVLET PRGRAMMING.
Introduction to Server-Side Web Development Introduction to Server-Side Web Development Session II: Introduction to Server-Side Web Development with Servlets.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
1 Java Servlets l Servlets : programs that run within the context of a server, analogous to applets that run within the context of a browser. l Used to.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
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.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
©SoftMoore ConsultingSlide 1 Overview of Servlets and JavaServer Pages (JSP)
UMass Lowell Computer Science Java and Distributed Computing Prof. Karen Daniels Fall, 2000 Lecture 21 Java Servlets Wed. 11/22/00 based on material.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Chapter 4 Request and Response. Servlets are controlled by the container.
Java Server Pages. 2 Servlets The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Introduction to Servlets
Servlets.
Development of Web Applications - Introduction
Java Servlets By: Tejashri Udavant..
Development of Web Applications – Introduction revisited
Design and Maintenance of Web Applications in J2EE
MSIS 655 Advanced Business Applications Programming
Chapter 26 Servlets.
Chapter 27 WWW and HTTP.
Distributed System Using Java 2 Enterprise Edition (J2EE)
Introduction to 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.
Objectives In this lesson you will learn about: Need for servlets
COP 4610L: Applications in the Enterprise Spring 2005
COP 4610L: Applications in the Enterprise Spring 2005
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

J2EE Lecture 1:Servlet and JSP Dr. Ming Qiu Xiamen University Software School mingqiu@xmu.edu.cn

1. Preliminary Topics What do Web Server and Client do? HTML and HTTP GET and POST URL What will Web Server not do ?

1.1 What do Web Server and Client do? Head First to Servlets and JSP, Chap 01 1.1 What do Web Server and Client do?

1.1.1 HTML and HTTP HTML- HyperText Markup Language Head First to Servlets and JSP, Chap 01 1.1.1 HTML and HTTP HTML- HyperText Markup Language Web Server often send the browser a set of instructions written in HTML. Tells the browser how to present the content to the user HTTP – HyperText Transport Protocol Allows for simple request and response conversation. The client sends an HTTP request. The Server answers with an HTTP response.

Head First to Servlets and JSP, Chap 01 1.1.1 HTML and HTTP

Head First to Servlets and JSP, Chap 01 1.1.2 GET and POST

1.1.3 Uniform Resource Locators Head First to Servlets and JSP, Chap 01 1.1.3 Uniform Resource Locators

Head First to Servlets and JSP, Chap 01 Type a URL The browser create an HTTP GET request The HTTP GET is sent to the server And generates an HTTP response The server finds the page The browser rends HTML The response is sent to the browser

1.2 What will Web Server alone not do? Head First to Servlets and JSP, Chap 01 1.2 What will Web Server alone not do? Dynamic Content Saving the Data on the Server

2. Servlets Introduction Interface Servlet and HttpServlet

2.1Introduction Servlets and Java Server Pages (JSP) Java How to Program, Fifth Edition, Chap 24 2.1Introduction Servlets and Java Server Pages (JSP) Request-response model Packages javax.servlet javax.servlet.http javax.servlet.jsp javax.servlet.tagext Form the Web tier of J2EE

2.1Introduction Servlets under control of a container Java How to Program, Fifth Edition, Chap 24 2.1Introduction Servlets under control of a container

2.1 Introduction Servlet Request/response mechanism Head First to Servlets and JSP, Chap 02 2.1 Introduction Servlet Request/response mechanism

2.1 Introduction What does the container do? Communications support Head First to Servlets and JSP, Chap 02 2.1 Introduction What does the container do? Communications support Lifecycle Management Multithread Support Declarative security JSP Support

2.1 Introduction How the Container handles a request Head First to Servlets and JSP, Chap 02 2.1 Introduction How the Container handles a request

Head First to Servlets and JSP, Chap 02 2.1 Introduction

Head First to Servlets and JSP, Chap 02 2.1 Introduction

Java How to Program, Fifth Edition, Chap 24

Java How to Program, Fifth Edition, Chap 24 2.1 Introduction

Java How to Program, Fifth Edition, Chap 24 2.1 Introduction

Java How to Program, Fifth Edition, Chap 24 2.1 Introduction

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet Interface Servlet All servlets must implement this interface All methods of interface Servlet are invoked by servlet container GenericServlet and HttpServlet

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet Overrides method service Two most common HTTP request types get requests post requests Method doGet responds to get requests Method doPost responds to post requests HttpServletRequest and HttpServletResponse objects

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet HttpServletRequest Interface

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet HttpServletResponse Interface

Handling HTTP get Requests Containing Data Java How to Program, Fifth Edition, Chap 24 Handling HTTP get Requests Containing Data

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet

Handling HTTP post Requests Containing Data Java How to Program, Fifth Edition, Chap 24 Handling HTTP post Requests Containing Data

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet

2.2 Interface Servlet and HttpServlet Java How to Program, Fifth Edition, Chap 24 2.2 Interface Servlet and HttpServlet

3. JSP JavaServer Pages Reuse existing Java components Java How to Program, Fifth Edition, Chap 25 3. JSP JavaServer Pages Extension of Servlet technology Reuse existing Java components Without programming Java Create custom tags Encapsulate complex functionality Classes and interfaces specific to JSP Package javax.servlet.jsp Package javax.servlet.jsp.tagext

Java How to Program, Fifth Edition, Chap 25 3. JSP

Java How to Program, Fifth Edition, Chap 25 3. JSP

3. JSP In the end, JSP is just a servlet Head First to Servlets and JSP, Chap 07 3. JSP In the end, JSP is just a servlet

3 JSP JSPs Servlets Used when content is mostly fixed-template data Java How to Program, Fifth Edition, Chap 25 3 JSP JSPs Used when content is mostly fixed-template data Small amounts of content generated dynamically Servlets Used when small amount of content is fixed-template data Most content generated dynamically

3. JSP Custom Tag Library JSP’s tag extension mechanism Java How to Program, Fifth Edition, Chap 25 3. JSP Custom Tag Library JSP’s tag extension mechanism Enables programmers to define new tags Tags encapsulate complex functionality, written in java code Keep java code out of the pages.