Web Server Programming 1. Nuts and Bolts. Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some.

Slides:



Advertisements
Similar presentations
CGI programming. Common Gateway Interface interface between web server and other programs (cgi scripts) information passed as environment variables passed.
Advertisements

M-V-C for web applications. Model for Web Applications model consists of data and system state database tables –persistent data session information –current.
 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.
CSE 190: Internet E-Commerce Lecture 7. HTML Templates Designed to separate server side logic from HTML presentation Key features –Escapes from HTML into.
An introduction to Java Servlet Programming
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
June 1, 2000 Object Oriented Programming in Java (95-707) Advanced Topics 1 Lecture 10 Object Oriented Programming in Java Advanced Topics Servlets.
1 CS6320 – Servlet Structure and Lifecycle L. Grewe.
Servlets CS-328 Dick Steflik. What is a servlet A Java application run on a thread of the webserver in response to an HTTP GET or POST request. The servlet.
Introduction to Servlet & JSP
Comp2513 Java Servlet Basics Daniel L. Silver, Ph.D.
Java Server and Servlet CS616 Team 9 Kim Doyle, Susan Kroha, Arunima Palchowdhury, Wei Xu.
/ department of mathematics and computer sciencedepartment of mathematics and computer science / architecture of information systems.
Session-02.
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.
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.
Java Server Pages B.Ramamurthy. Topics for Discussion 8/20/20152 Inheritance and Polymorphism Develop an example for inheritance and polymorphism JSP.
1 Chapter 2 The Web Tier  Web Applications and Web ContainersWeb Applications and Web Containers  Dynamic Content CreationDynamic Content Creation 
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
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,
Servlet Lifecycle Lec 28. Servlet Life Cycle  Initialize  Service  Destroy Time.
Java Servlets & Java Server Pages Lecture July 2013.
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.
JavaServer Page by Antonio Ko. Overview ► Introduction ► What is a servlet? ► What can servlets do? ► Servlets Vs JSP ► Syntax ► Samples ► JavaBean ►
L.MARIA MICHAEL VISUWASAM UNIT-4
Java Servlets and Java Server Pages Norman White Stern School of Business.
Copyright © 2002 ProsoftTraining. All rights reserved. Java Servlets.
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.
CSE 403 The Mythical Servlet Goals Introduce basic servlet terminology Formally introduce homework 2 Walkthrough of build & deployment Group discussion.
Middleware 3/29/2001 Kang, Seungwoo Lee, Jinwon. Description of Topics 1. CGI, Servlets, JSPs 2. Sessions/Cookies 3. Database Connection(JDBC, Connection.
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.
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.
Java Servlets Java Server Pages (JSP)
Advanced Java Session 6 New York University School of Continuing and Professional Studies.
K. K. Wagh Polytechnic, Nashik
Java and the Web CSE 3330 Southern Methodist University.
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 Servlets and Java Server Pages
HTTP protocol Java Servlets. HTTP protocol Web system communicates with end-user via HTTP protocol HTTP protocol methods: GET, POST, HEAD, PUT, OPTIONS,
SERVLET THETOPPERSWAY.COM
Introduction To HTML Dr. Magdi AMER. HTML elements.
How CGI and Java Servlets are Run By David Stein 14 November 2006.
April 20023CSG11 Electronic Commerce Java (2) John Wordsworth Department of Computer Science The University of Reading Room 129,
Chapter 4 Request and Response. Servlets are controlled by the container.
1 Lecture 8 George Koutsogiannakis/Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications.
Distributed Web Systems Java Servlets Lecturer Department University.
Introduction to Servlets
Servlets.
Servlet Fudamentals.
Java Servlets By: Tejashri Udavant..
HTTP Servlet Overview Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might.
Chapter 26 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.
J2EE Lecture 1:Servlet and JSP
CS122B: Projects in Databases and Web Applications Winter 2019
Java Chapter 7 (Estifanos Tilahun Mihret--Tech with Estif)
Presentation transcript:

Web Server Programming 1. Nuts and Bolts

Premises of Course Provides general introduction, no in-depth training Assumes some HTML knowledge Assumes some programming experience Assumes some knowledge of object orientation Only treats JAVA applications. Alternatives: –Perl, (PHP) –XML

Web Services Document level –XML + Style sheets –Client-side programming (javascript, applets) –Server-side programming: CGI JAVA servlets HTML++ / XML++ (SSI: php, asp, jsp) RPCs

Contents of this course Web technology: protocols & languages Web server: request handling, output generation, session & user management Server programming: –Java servlets –JSP

What This Course Is NOT About RPCs Use of XML for (enterprise) web services Layout & content management Use of external components (databases, etc.) Client based software (applets, etc.)

About the Web Reinier Post

JAVA Support Component based Platform independent Built-in security Software libraries for every application

Web Applications Cooperating parts: –(HTML) documents –Servlets –JSP pages –Applets (client side software) Common context –Properties (appl. param., configuration data) –Resources (shared data)

JAVA servlets Alternative for CGI scripts: JAVA technology Servlet support integrated in server –JAVA threads: no independent process –Sharing of resources Protocol independent Security issues: JAVA sandbox

JSP Pages Based on HTML or XML Contain processing tags Use servlet classes Converted to servlet

What About Servlets? Standard for interfacing web client with web server. Set of JAVA packages (javax.servlet, javax.servlet.http) Way of interfacing clients with back-end services (JDBC servers, etc.) Way to implement proxies (e.g. for applets)

Servlet API Interface Servlet Interface ServletConfig Interface ServletContext Interface ServletRequest Interface ServletResponse

Interface Servlet Init() Service() Destroy() getServletConfig() getServletInfo()

Class HttpServlet Inherits from GenericServlet (impl. Servlet) Additional methods: –doGet() –doPost() –doHead() –doDelete() –doOptions() –doTrace()

Requests and Responses Interface HttpServletRequest –Request as stream –HTTP headers –Parameters –Path info Interface HttpServletResponse –Output stream –HTTP headers –Cookies

Example: TestServlet.java Implements doGet() and doPost() using common (private) function doIt() Analyses client request and shows: –Servlet requested –Path info –Get and post parameters

public class TestServlet extends HttpServlet { private static final String CONTENT_TYPE = "text/html"; private PrintWriter out; //Initialize global variables public void init() throws ServletException { } //Process the HTTP Get request public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doIt(request, response); } //Process the HTTP Post request public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doIt(request, response); } private void doIt(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType(CONTENT_TYPE); out = res.getWriter(); out.println(" ");.. out.println(" "); } //Clean up resources public void destroy() { }

Assignment Modify TestServlet to show the current date. Study the servlet API documentation. Modify TestServlet to show initial parameters, and provide some of those.