6 Feb 2002PL Day1 Programming Interactive Web Scripts Matthias Felleisen PLT.

Slides:



Advertisements
Similar presentations
How Many Continuations can Dance on the Head of a Pin Matthias Felleisen King of Continuations and Professor of Computer Science.
Advertisements

Programming the Interactive Web Shriram Krishnamurthi Brown University.
Adding Dynamic Content to your Web Site
W EB A PPLICATION D EVELOPMENT A PPLICATION T O B IO -I NFORMATICS -III Vicky Khanna M-Tech Bioinformatics.
 2002 Prentice Hall. All rights reserved. Chapter 9: Servlets Outline 9.1 Introduction 9.2 Servlet Overview and Architecture Interface Servlet and.
DT228/3 Web Development WWW and Client server model.
Languages for Dynamic Web Documents
Common Gateway Interface (CGI). CGI is a protocol: CGI is not a programming language CGI is a protocol for the exchange of information between between.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Browsers and Servers CGI Processing Model ( Common Gateway Interface ) © Norman White, 2013.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
Automatic Information Retrieval from Bioinformatics Websites Kang Peng.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 34 Servlets.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
LYU9901-Travel Net LYU9901-Travel Net Supervisor: Prof. Michael R. Lyu Students: Ho Chi Ho Malcolm Lau Chi Ho Arthur (Presentation on )
Multiple Tiers in Action
CGI and Perl MSc Publishing on the WWW. What is CGI ? (1) User Buying and selling Playing games Customised web pages Developer Means to run external programs.
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.
Definitions, Definitions, Definitions Lead to Understanding.
CIS 365 Vandana Janeja Nov 27 th 2001 Connecting Cobol programs to Other Languages- Visual Basic, Java,HTML.
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.
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.
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.
ITM352 Javascript and Dynamic Web Pages: Client Side Processing.
CGI Programming Languages Web Based Software Development July 21, 2005 Song, JaeHa.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
1 Homework / Exam Exam 3 –Solutions Posted –Questions? HW8 due next class Final Exam –See posted schedule Websites on UNIX systems Course Evaluations.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Beyond DHTML So far we have seen and used: CGI programs (using Perl ) and SSI on server side Java Script, VB Script, CSS and DOM on client side. For some.
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
1 CS 3870/CS 5870 Static and Dynamic Web Pages ASP.NET and IIS.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
GDT V5 Web Services. GDT V5 Web Services Doug Evans and Detlef Lexut GDT 2008 International User Conference August 10 – 13  Lake Las Vegas, Nevada GDT.
An program As a simple example of socket programming we can implement a program that sends to a remote site As a simple example of socket.
20-753: Fundamentals of Web Programming 1 Lecture 1: Introduction Fundamentals of Web Programming Lecture 1: Introduction.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
CS4273: Distributed System Technologies and Programming Lecture 13: Review.
Java CGI Lecture notes by Theodoros Anagnostopoulos.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
CSCE Systems Programming Lecture 21 Web Server: CGI -Dynamic Pages CSCE March 25, 2013.
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
Active Server Pages  In this chapter, you will learn:  How browsers and servers interacted on the Internet when the Internet first became popular 
1 Nov 2001Yale1 Programming Interactive Web Scripts Matthias Felleisen Northeastern University.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Chapter 6 Server-side Programming: Java Servlets
CGI Common Gateway Interface. CGI is the scheme to interface other programs to the Web Server.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Overview Web Session 3 Matakuliah: Web Database Tahun: 2008.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
ASP (Active Server Pages) by Bülent & Resul. Presentation Outline Introduction What is an ASP file? How does ASP work? What can ASP do? Differences Between.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Java for networking Module Introduction Data Communications Communication architecture Application.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Fall 2000C.Watters1 World Wide Web and E-Commerce Servers & Server Side Processing.
Copyright © 2003 T. Trappenberg Overview B 1 B. Some tools of the trade Module 1 Technology: GR01E - Electronic Commerce Overview.
Chapter 3 JSP Overview. The Problem with Servlets processing the request and generating the response are both handled by a single servlet class Java programming.
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 14 Database Connectivity and Web Technologies.
How CGI and Java Servlets are Run By David Stein 14 November 2006.
Server-side http General form of http response/request GET request method POST request method Responses Servlet support.
1 Introducing Web Developer Tools Rapid application development tools ASP.NET-compatible web editors –Visual Studio.NET Professional Edition –Visual Studio.
Lesson 11. CGI CGI is the interface between a Web page or browser and a Web server that is running a certain program/script. The CGI (Common Gateway Interface)
Internet/Web Databases
Section 6.3 Server-side Scripting
Chapter 27 WWW and HTTP.
Introduction to Servlets
Presentation transcript:

6 Feb 2002PL Day1 Programming Interactive Web Scripts Matthias Felleisen PLT

6 Feb 2002PL Day2 PLT principles of program design –introductory –script development principles of programming languages –design –analysis –correctness programming environments & tools

6 Feb 2002PL Day3 PLT: First Session principles of program design –introductory –script development: dynamic Web content principles of programming languages –design –analysis –correctness programming environments & tools

6 Feb 2002PL Day4 Dynamic Web Content USA Today says: “… more than half the pages on the Web are generated on demand.” (July 2000) Why? –connection to up-to-date database –determining consumer information –on-line experiments –games

6 Feb 2002PL Day5 Dynamic Web Content Technology: Programming, Contents Programming first: –CGI –Java Servlets Contents first –Active Server Pages –Java Server Pages

6 Feb 2002PL Day6 Dynamic Web Content What is a CGI script? a servlet? How do they work? Why is it difficult to design interactive ones? Can we automate their development? What does this teach us about GUI dialogues in general?

6 Feb 2002PL Day7 The Common Gateway Interface

6 Feb 2002PL Day8

6 Feb 2002PL Day9 Interactive Web Scripts Some URLs point to programs. The server invokes the program, which writes a page to the standard output port and then terminates. The server sents the page to the client that requested the URL.

6 Feb 2002PL Day10 Interactive Web Scripts: Hello World (printf "My First CGI Page~n”) (printf "Hello World") Plain Program (output-http-headers) (write-xml/content (xexpr->xml '(html (title "My First CGI Page") (body "Hello World")))) Web Script

6 Feb 2002PL Day11 Interactive Web Scripts: Server Status (output-http-headers) (write-xml/content (xexpr->xml `(html (title "Server Status") (body,(read-line (first (process "uptime"))))))) (printf "Server Status: ~a~n" (read-line (first (process "uptime")))))))

6 Feb 2002PL Day12 Interactive Web Scripts: Multiply-by-10.com (output-http-headers) (define (get-number) (get-binding ‘NUM (bindings))) (write-xml/content (xexpr->xml `(html (title "Multiply-by-10.com") (body "the result is: ",(* (get-number) 10))))) (define (get-number) (printf "Enter a number ") (flush-output) (read)) (printf "Multiply-by-10.com") (printf "the result is: ~a" (* (get-number) 10) )

6 Feb 2002PL Day13 Interactive Web Scripts: Multiply-by-10.com Multiply-by-10.com Multiply <form method="get" action=" Enter a number Where do babies come from?

6 Feb 2002PL Day14 Interactive Web Scripts: Multiply-by-10.com

6 Feb 2002PL Day15 Interactive Web Scripts: Multiply.com (output-http-headers) … (write-xml/content (xexpr->xml `(html (title "Multiply.com") (body "the result is: ",(* (get-number) (get-number)))))) (define (get-number) (printf "Enter a number ") (flush-output) (read)) (printf "Multiply.com") (printf "the result is: ~a" (* (get-number) (get-number)) )

6 Feb 2002PL Day16 Interactive Web Scripts: DontMultiply.com A CGI script terminates after producing a page. To query the consumer, the script must produce a page with a form. Ergo: To interact, a CGI program must terminate.

6 Feb 2002PL Day17 Interactive Web Scripts: DontMultipy.com The natural structure of an interactive Web program doesn’t work naturally with the Common Gateway Interface.

6 Feb 2002PL Day18 Interactive Web Scripts: Interaction Current solution: programmers invert program by hand. A program with N interaction points becomes a set of N programs. The programs communicate all necessary data “manually”.

6 Feb 2002PL Day19 Interacting with Web Scripts

6 Feb 2002PL Day20 Interacting with Web Scripts

6 Feb 2002PL Day21 Interacting with Web Scripts

6 Feb 2002PL Day22 Interacting with Web Scripts And now we go BACK:

6 Feb 2002PL Day23 Interacting with Web Scripts

6 Feb 2002PL Day24 Interactive Web Scripts: Multiply.com Multiply Multiply <form method="get" action=" Enter a number

6 Feb 2002PL Day25 Interactive Web Scripts: cgi-first.ss (output-http-headers) (write-xml/content (xexpr->xml `(html (title "The Multiply Page") (body `(form ([method "get"][action " (p "Enter the second number") (input ([type "hidden"][name "first"] [value,(get-number)])) (input ([type "text"] [name "second"][value "1"])))))))

6 Feb 2002PL Day26 Interactive Web Scripts: Multiply.com Multiply Multiply <form method="get" action=" Enter the second number

6 Feb 2002PL Day27 Interactive Web Scripts: cgi-second.ss (output-http-headers) (write-xml/content (xexpr->xml `(html (title "The Multiply Page") (body "the result is: ",(* (get-number 'first) (get-number ’NUM))))))))

6 Feb 2002PL Day28 Interactive Web Scripts and Continuations (define multiply (lambda (x y) (* x y))) (define multiply (lambda (x) (lambda (y) (* x y)))) (define multiply-by-22 (lambda (y) (* 22 y)))

6 Feb 2002PL Day29 Interactive Web Scripts and Continuations cgi scriptconsumer cgi scriptconsumer the back button

6 Feb 2002PL Day30 Interactive Web Scripts and Continuations cgi scriptconsumer cgi scriptconsumer the back button cloning

6 Feb 2002PL Day31 PLT’s Interactive Web Script Solution 1: Design Web server that supports coroutining. Use continuation objects. Graunke et al. ESOP 2001 Solution 2: Design transformation that automatically inverts programs with N interaction points into N programs. Graunke et al. ASE 2001 & Jacob Matthews PL Day 2002

6 Feb 2002PL Day32 PLT’s Interactive GUI Scripts Generalize this technique to certain GUI programs. Graunke and Krishnamurthi, ICSE Graunke PL Day 2002.