 2006 Pearson Education, Inc. All rights reserved. 1 19 Web Programming.

Slides:



Advertisements
Similar presentations
1 Copyright © 2002 Pearson Education, Inc.. 2 Chapter 1 Introduction to Perl and CGI.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Adding Dynamic Content to your Web Site
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
DT228/3 Web Development WWW and Client server model.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 21 – Web Servers (IIS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 21 – Web Servers (IIS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System.
INTERNET DATABASE Chapter 9. u Basics of Internet, Web, HTTP, HTML, URLs. u Advantages and disadvantages of Web as a database platform. u Approaches for.
Web Servers How do our requests for resources on the Internet get handled? Can they be located anywhere? Global?
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
 2002 Prentice Hall. All rights reserved. 1 Chapter 6 – Introduction to the Common Gateway Interface (CGI) Outline 6.1 Introduction 6.2 Client and Web.
How the web works: HTTP and CGI explained
INTERNET DATABASE. Internet and E-commerce Internet – a worldwide collection of interconnected computer network Internet – a worldwide collection of interconnected.
1 CS6320 – Why Servlets? L. Grewe 2 What is a Servlet? Servlets are Java programs that can be run dynamically from a Web Server Servlets are Java programs.
 2006 Pearson Education, Inc. All rights reserved Web Programming.
 2008 Pearson Education, Inc. All rights reserved Web Servers (IIS and Apache)
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
SE-2840 Dr. Mark L. Hornick1 Java Servlet-based web apps Servlet Architecture.
8/17/2015CS346 PHP1 Module 1 Introduction to PHP.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
1 Web Servers (IIS and Apache) Outline 9.1 Introduction 9.2 HTTP Request Types 9.3 System Architecture 9.4 Client-Side Scripting versus Server-Side Scripting.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 16 - Web Programming with CGI Outline 16.1 Introduction 16.2 HTTP Request Types 16.3 Multi-Tier.
INTRODUCTION TO WEB DATABASE PROGRAMMING
Computer Concepts 2014 Chapter 7 The Web and .
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 29.1 Multi-Tier Architecture 29.2 Web Servers.
1 Web Server Concepts Dr. Awad Khalil Computer Science Department AUC.
Copyright © cs-tutorial.com. Introduction to Web Development In 1990 and 1991,Tim Berners-Lee created the World Wide Web at the European Laboratory for.
Chapter 33 CGI Technology for Dynamic Web Documents There are two alternative forms of retrieving web documents. Instead of retrieving static HTML documents,
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Describe several.
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
Chapter 6 The World Wide Web. Web Pages Each page is an interactive multimedia publication It can include: text, graphics, music and videos Pages are.
 2005 Pearson Education, Inc. All rights reserved Servlets.
 2008 Pearson Education, Inc. All rights reserved Ajax-Enabled Rich Internet Applications.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 21 - Web Servers (IIS, PWS and Apache) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3.
CS453: State in Web Applications (Part 1) State in General Sessions (esp. in PHP) Prof. Tom Horton.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
 2004 Prentice Hall, Inc. All rights reserved. 1 Segment – 6 Web Server & database.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Chapter 6 Server-side Programming: Java Servlets
1 Welcome to CSC 301 Web Programming Charles Frank.
11 1 Cookies CGI/Perl Programming By Diane Zak Objectives In this chapter, you will: Learn the difference between temporary and persistent cookies.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
1 Web Servers (Chapter 21 – Pages( ) Outline 21.1 Introduction 21.2 HTTP Request Types 21.3 System Architecture.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
ECMM6018 Enterprise Networking for Electronic Commerce Tutorial 7
27.1 Chapter 27 WWW and HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction and Principles Web Server Scripting.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
JavaScript and Ajax (Internet Background) Week 1 Web site:
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
1 Chapter 22 World Wide Web (HTTP) Chapter 22 World Wide Web (HTTP) Mi-Jung Choi Dept. of Computer Science and Engineering
TCP/IP Protocol Suite 1 Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 22 World Wide Web and HTTP.
The Common Gateway Interface (CGI) Pat Morin COMP2405.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
WWW and HTTP King Fahd University of Petroleum & Minerals
JavaScript and Ajax (Internet Background)
CNIT 131 Internet Basics & Beginning HTML
Chapter 19 PHP Part III Credits: Parts of the slides are based on slides created by textbook authors, P.J. Deitel and H. M. Deitel by Prentice Hall ©
MapServer In its most basic form, MapServer is a CGI program that sits inactive on your Web server. When a request is sent to MapServer, it uses.
IS333D: MULTI-TIER APPLICATION DEVELOPMENT
Client side & Server side scripting
Web Servers (IIS and Apache)
Presentation transcript:

 2006 Pearson Education, Inc. All rights reserved Web Programming

 2006 Pearson Education, Inc. All rights reserved. 2 This is the common air that bathes the globe. — Walt Whitman The longest part of the journey is said to be the passing of the gate. — Marcus Terentius Varro Railway termini... are our gates to the glorious and unknown. Through them we pass out into adventure and sunshine, to them, alas! we return. — E. M. Forster There comes a time in a man’s life when to get where he has to go—if there are no doors or windows—he walks through a wall. — Bernard Malamud

 2006 Pearson Education, Inc. All rights reserved. 3 OBJECTIVES In this chapter you will learn:  The Common Gateway Interface (CGI) protocol.  The Hypertext Transfer Protocol (HTTP) and HTTP headers.  Web server's functionality.  The Apache HTTP Server.  To request documents from a Web server.  To implement CGI scripts.  To send input to CGI scripts using XHTML forms.

 2006 Pearson Education, Inc. All rights reserved Introduction 19.2 HTTP Request Types 19.3 Multitier Architecture 19.4 Accessing Web Servers 19.5 Apache HTTP Server 19.6 Requesting XHTML Documents 19.7 Introduction to CGI 19.8 Simple HTTP Transactions 19.9 Simple CGI Scripts Sending Input to a CGI Script Using XHTML Forms to Send Input Other Headers Case Study: An Interactive Web Page Cookies Server-Side Files Case Study: Shopping Cart Wrap-Up Internet and Web Resources

 2006 Pearson Education, Inc. All rights reserved. 5 Software Engineering Observation 19.1 The data sent in a post request is not part of the URL and cannot be seen by users. Forms that contain many fields often are submitted to Web servers via post requests. Sensitive form fields, such as passwords, should be sent using this request type.

 2006 Pearson Education, Inc. All rights reserved. 6 Fig | HTTP’s other request types.

 2006 Pearson Education, Inc. All rights reserved. 7 Fig | Three-tier application model.

 2006 Pearson Education, Inc. All rights reserved. 8 Fig | Requesting test.html from Apache.

 2006 Pearson Education, Inc. All rights reserved. 9 Fig | Client interacting with server and Web server. Step 1: The get request, GET /books/downloads.html HTTP/1.1. (Part 1 of 2.)

 2006 Pearson Education, Inc. All rights reserved. 10 Fig | Client interacting with server and Web server. Step 2: The HTTP response, HTTP/ OK. (Part 2 of 2.)

 2006 Pearson Education, Inc. All rights reserved. 11 Outline localtime.cpp (1 of 2)

 2006 Pearson Education, Inc. All rights reserved. 12 Outline localtime.cpp (2 of 2)

 2006 Pearson Education, Inc. All rights reserved. 13 Fig | Step 1: The get request, GET /cgi-bin/localtime.cgi HTTP/1.1. (Part 1 of 4.)

 2006 Pearson Education, Inc. All rights reserved. 14 Fig | Step 2: The Web server starts the CGI script. (Part 2 of 4.)

 2006 Pearson Education, Inc. All rights reserved. 15 Fig | Step 3: The script output is sent to the Web server. (Part 3 of 4.)

 2006 Pearson Education, Inc. All rights reserved. 16 Fig | Step 4: The HTTP response, HTTP/ OK. (Part 4 of 4.)

 2006 Pearson Education, Inc. All rights reserved. 17 Common Programming Error 19.1 Forgetting to place a blank line after a header is a syntax error.

 2006 Pearson Education, Inc. All rights reserved. 18 Fig | Output of localtime.cgi when executed from the command line.

 2006 Pearson Education, Inc. All rights reserved. 19 Outline environment.cpp (1 of 4)

 2006 Pearson Education, Inc. All rights reserved. 20 Outline environment.cpp (2 of 4)

 2006 Pearson Education, Inc. All rights reserved. 21 Outline environment.cpp (3 of 4)

 2006 Pearson Education, Inc. All rights reserved. 22 Outline environment.cpp (4 of 4)

 2006 Pearson Education, Inc. All rights reserved. 23 Outline querystring.cpp (1 of 3)

 2006 Pearson Education, Inc. All rights reserved. 24 Outline querystring.cpp (2 of 3)

 2006 Pearson Education, Inc. All rights reserved. 25 Outline querystring.cpp (3 of 3)

 2006 Pearson Education, Inc. All rights reserved. 26 Fig | XHTML form elements. (Part 1 of 2)

 2006 Pearson Education, Inc. All rights reserved. 27 Fig | XHTML form elements. (Part 2 of 2)

 2006 Pearson Education, Inc. All rights reserved. 28 Outline getquery.cpp (1 of 4)

 2006 Pearson Education, Inc. All rights reserved. 29 Outline getquery.cpp (2 of 4)

 2006 Pearson Education, Inc. All rights reserved. 30 Outline getquery.cpp (3 of 4)

 2006 Pearson Education, Inc. All rights reserved. 31 Outline getquery.cpp (4 of 4)

 2006 Pearson Education, Inc. All rights reserved. 32 Outline post.cpp (1 of 5)

 2006 Pearson Education, Inc. All rights reserved. 33 Outline post.cpp (2 of 5)

 2006 Pearson Education, Inc. All rights reserved. 34 Outline post.cpp (3 of 5)

 2006 Pearson Education, Inc. All rights reserved. 35 Outline post.cpp (4 of 5)

 2006 Pearson Education, Inc. All rights reserved. 36 Outline post.cpp (5 of 5)

 2006 Pearson Education, Inc. All rights reserved. 37 Outline travel.html (1 of 2)

 2006 Pearson Education, Inc. All rights reserved. 38 Outline travel.html (2 of 2)

 2006 Pearson Education, Inc. All rights reserved. 39 Outline portal.cpp (1 of 5)

 2006 Pearson Education, Inc. All rights reserved. 40 Outline portal.cpp (2 of 5)

 2006 Pearson Education, Inc. All rights reserved. 41 Outline portal.cpp (3 of 5)

 2006 Pearson Education, Inc. All rights reserved. 42 Outline portal.cpp (4 of 5)

 2006 Pearson Education, Inc. All rights reserved. 43 Outline portal.cpp (5 of 5)

 2006 Pearson Education, Inc. All rights reserved. 44 Performance Tip 19.1 It is always much more efficient for the server to provide static content rather than execute a CGI script, because it takes time for the server to load the script from hard disk into memory and execute the script (whereas an XHTML file needs to be sent only to the client). It is a good practice to use a mix of static XHTML (for content that generally remains unchanged) and CGI scripting (for dynamic content). This practice allows the Web server to respond to clients more efficiently than if only CGI scripting were used.

 2006 Pearson Education, Inc. All rights reserved. 45 Outline cookieform.html (1 of 2)

 2006 Pearson Education, Inc. All rights reserved. 46 Outline cookieform.html (2 of 2)

 2006 Pearson Education, Inc. All rights reserved. 47 Outline writecookie.cpp (1 of 4)

 2006 Pearson Education, Inc. All rights reserved. 48 Outline writecookie.cpp (2 of 4)

 2006 Pearson Education, Inc. All rights reserved. 49 Outline writecookie.cpp (3 of 4)

 2006 Pearson Education, Inc. All rights reserved. 50 Outline writecookie.cpp (4 of 4)

 2006 Pearson Education, Inc. All rights reserved. 51 Portability Tip 19.1 Web browsers store the cookie information in a vendor-specific manner. For example, Microsoft’s Internet Explorer stores cookies as text files in the Temporary Internet Files directory on the client’s machine. Netscape stores its cookies in a single file named cookies.txt.

 2006 Pearson Education, Inc. All rights reserved. 52 Outline readcookie.cpp (1 of 3)

 2006 Pearson Education, Inc. All rights reserved. 53 Outline readcookie.cpp (2 of 3)

 2006 Pearson Education, Inc. All rights reserved. 54 Outline readcookie.cpp (3 of 3)

 2006 Pearson Education, Inc. All rights reserved. 55 Software Engineering Observation 19.2 Cookies present a security risk. If unauthorized users gain access to a computer, they can examine the local disk and view files, which include cookies. For this reason, sensitive data, such as passwords, social security numbers and credit card numbers, should never be stored in cookies.

 2006 Pearson Education, Inc. All rights reserved. 56 Outline savefile.html (1 of 2)

 2006 Pearson Education, Inc. All rights reserved. 57 Outline savefile.html (2 of 2)

 2006 Pearson Education, Inc. All rights reserved. 58 Outline savefile.cpp (1 of 6)

 2006 Pearson Education, Inc. All rights reserved. 59 Outline savefile.cpp (2 of 6)

 2006 Pearson Education, Inc. All rights reserved. 60 Outline savefile.cpp (3 of 6)

 2006 Pearson Education, Inc. All rights reserved. 61 Outline savefile.cpp (4 of 6)

 2006 Pearson Education, Inc. All rights reserved. 62 Outline savefile.cpp (5 of 6)

 2006 Pearson Education, Inc. All rights reserved. 63 Outline savefile.cpp (6 of 6)

 2006 Pearson Education, Inc. All rights reserved. 64 Fig | Contents of clients.txt data file.

 2006 Pearson Education, Inc. All rights reserved. 65 Outline login.cpp (1 of 11)

 2006 Pearson Education, Inc. All rights reserved. 66 Outline login.cpp (2 of 11)

 2006 Pearson Education, Inc. All rights reserved. 67 Outline login.cpp (3 of 11)

 2006 Pearson Education, Inc. All rights reserved. 68 Outline login.cpp (4 of 11)

 2006 Pearson Education, Inc. All rights reserved. 69 Outline login.cpp (5 of 11)

 2006 Pearson Education, Inc. All rights reserved. 70 Outline login.cpp (6 of 11)

 2006 Pearson Education, Inc. All rights reserved. 71 Outline login.cpp (7 of 11)

 2006 Pearson Education, Inc. All rights reserved. 72 Outline login.cpp (8 of 11)

 2006 Pearson Education, Inc. All rights reserved. 73 Outline login.cpp (9 of 11)

 2006 Pearson Education, Inc. All rights reserved. 74 Outline login.cpp (10 of 11)

 2006 Pearson Education, Inc. All rights reserved. 75 Outline login.cpp (11 of 11)

 2006 Pearson Education, Inc. All rights reserved. 76 Outline shop.cpp (1 of 5)

 2006 Pearson Education, Inc. All rights reserved. 77 Outline shop.cpp (2 of 5)

 2006 Pearson Education, Inc. All rights reserved. 78 Outline shop.cpp (3 of 5)

 2006 Pearson Education, Inc. All rights reserved. 79 Outline shop.cpp (4 of 5)

 2006 Pearson Education, Inc. All rights reserved. 80 Outline shop.cpp (5 of 5)

 2006 Pearson Education, Inc. All rights reserved. 81 Outline viewcart.cpp (1 of 7)

 2006 Pearson Education, Inc. All rights reserved. 82 Outline viewcart.cpp (2 of 7)

 2006 Pearson Education, Inc. All rights reserved. 83 Outline viewcart.cpp (3 of 7)

 2006 Pearson Education, Inc. All rights reserved. 84 Outline viewcart.cpp (4 of 7)

 2006 Pearson Education, Inc. All rights reserved. 85 Outline viewcart.cpp (5 of 7)

 2006 Pearson Education, Inc. All rights reserved. 86 Outline viewcart.cpp (6 of 7)

 2006 Pearson Education, Inc. All rights reserved. 87 Outline viewcart.cpp (7 of 7)

 2006 Pearson Education, Inc. All rights reserved. 88 Outline checkout.cpp (1 of 2)

 2006 Pearson Education, Inc. All rights reserved. 89 Outline checkout.cpp (2 of 2)

 2006 Pearson Education, Inc. All rights reserved. 90 Fig | Contents of catalog.txt.