1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.

Slides:



Advertisements
Similar presentations
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?
Advertisements

Tutorial 6 Creating a Web Form
Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Copyright 2004 Monash University IMS5401 Web-based Systems Development Topic 2: Elements of the Web (g) Interactivity.
Project 1 Introduction to HTML.
Tutorial 6 Working with Web Forms
Master’s course Bioinformatics Data Analysis and Tools Lecture 6: Internet Basics Centre for Integrative Bioinformatics.
HTTP Hypertext Transfer Protocol. HTTP messages HTTP is the language that web clients and web servers use to talk to each other –HTTP is largely “under.
How the web works: HTTP and CGI explained
Computing Concepts Advanced HTML: Tables and Forms.
The World Wide Web and the Internet Dr Jim Briggs 1WUCM1.
Python and Web Programming
Definitions, Definitions, Definitions Lead to Understanding.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
HTTP Overview Vijayan Sugumaran School of Business Administration Oakland University.
1st Project Introduction to 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.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
HTML 1 Introduction to HTML. 2 Objectives Describe the Internet and its associated key terms Describe the World Wide Web and its associated key terms.
Chapter 9 Working with Forms. Principles of Web Design 2nd Ed. Chapter 9 2 Principles of Web Design Chapter 9 Objectives Understand how forms work Understand.
1 ‘Dynamic’ Web Pages So far, we have developed ‘static’ web-pages, e.g., cv.html, repair.html and order.html. There is often a requirement to produce.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
NETWORK CENTRIC COMPUTING (With included EMBEDDED SYSTEMS)
HTML Forms What is a form.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
_______________________________________________________________________________________________________________ E-Commerce: Fundamentals and Applications1.
DAT602 Database Application Development Lecture 14 HTML.
Comp2513 Forms and CGI Server Applications Daniel L. Silver, Ph.D.
Server-side Scripting Powering the webs favourite services.
CP476 Internet Computing Lecture 5 : HTTP, WWW and URL 1 Lecture 5. WWW, HTTP and URL Objective: to review the concepts of WWW to understand how HTTP works.
TCP/IP Protocol Suite 1 Chapter 22 Upon completion you will be able to: World Wide Web: HTTP Understand the components of a browser and a server Understand.
Introduction to Programming the WWW I CMSC Summer 2004 Lecture 6.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 7: HTTP and CGI Fundamentals of Web Programming.
Working with Forms. How Forms Work Forms let you build interactive Web pages that collect information from a user and process it on the Web server The.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Web Design (1) Terminology. Coding ‘languages’ (1) HTML - Hypertext Markup Language - describes the content of a web page CSS - Cascading Style Sheets.
Perl CGI What is "CGI"? Common Gateway Interface A means of running an executable program via the Web. Perl have a *very* nice interface to create CGI.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Week 12 Working with Forms Objectives Understand how forms work Understand form syntax Create input objects Build forms within tables Build and.
Form Data Encoding GET – URL encoded POST – URL encoded
WWW: an Internet application Bill Chu. © Bei-Tseng Chu Aug 2000 WWW Web and HTTP WWW web is an interconnected information servers each server maintains.
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.
Web Design and Development. World Wide Web  World Wide Web (WWW or W3), collection of globally distributed text and multimedia documents and files 
Introduction to HTML. _______________________________________________________________________________________________________________ 2 Outline Key issues.
Internet Applications (Cont’d) Basic Internet Applications – World Wide Web (WWW) Browser Architecture Static Documents Dynamic Documents Active Documents.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Introduction to Web & HTML
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
Week 10: HTML Forms HNDIT11062 – Web Development.
HTML Concepts and Techniques Fifth Edition Chapter 1 Introduction to HTML.
Basic Webpage Design HTML Forms. Objectives Learn how to use HTML to create a form. Explain the concept of forms Know the difference of GET and POST Discuss.
Chapter 1 Introduction to HTML, XHTML, and CSS HTML5 & CSS 7 th Edition.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
Introduction to the World Wide Web & Internet CIS 101.
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.
Tutorial 6 Creating a Web Form
University of Kansas Department of Electrical Engineering and Computer Science Dr. Susan Gauch April 21, 2005 I T T C Introduction to Web Technologies.
Web Basics: HTML and HTTP
Chapter 1 Introduction to HTML.
Tutorial (4): HTTP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
CGI Programming Part II UNIX Security
Presentation transcript:

1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10

2 Objectives To introduce the Perl programming language Web protocols (HTML), web-perl interfaces (Perl) Recommended Books: SAMS – Teach yourself Perl in 24 hours – Clinton Pierce Beginning Perl for Bioinformatics – James Tisdall The Best way to learn Perl is to read the books, numerous tutorials and to Practice. These notes are not a comprehensive tutorial – reading extra material is essential CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Network Application Client application and server application communicate via a network protocol A protocol is a set of rules on how the client and server communicate 3 Web client Web server HTTP CSC8304 – Computing Environments for Bioinformatics - Lecture 10

HTTP The HyperText Transfer Protocol, an Internet standard. Latest version is 1.1. (RFC2068, Jan 1997) Web browser clients (e.g. Firefox, Internet Explorer) communicate with web servers (e.g. Apache) using this protocol. 4 HTTP request: Get file at this location … HTTP response: Here is the file … CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Resources Web servers host web resources, including HTML files, PDF files, GIF files, MPEG movies, etc. Each web object has an associated MIME type HTML document has type text/html JPEG image has type image/jpeg Web resource is accessed using a Uniform Resource Locator (URL) :80/modules/2009/CSC protocol host address port (optional) resource CSC8304 – Computing Environments for Bioinformatics - Lecture 10

HTTP Transactions HTTP request to web server GET /images/flion.jpg HTTP/1.1 Host: HTTP response to web client HTTP/ OK Content-type: image/jpeg Content-length: CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Sample HTTP Session GET / HTTP/1.1 HOST: HTTP/ OK Date: Tue, 1 Sep :00:42 GMT Server: Apache X-Powered-By: PHP/5.1.6 Content-Length: 5344 Connection: close Content-Type: text/html; charset=UTF-8 The School of Computing Science, Newcastle University. 7 request response CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Status Codes Status code in the HTTP response indicates if a request is successful Some typical status codes: 8 200OK 302Found; Resource in different URI 401Authorization required 403Forbidden 404Not Found CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Gateways Interface between resource and a web server 9 Web Server DB Gateway http CSC8304 – Computing Environments for Bioinformatics - Lecture 10

CGI Common Gateway Interface is a standard interface for running helper applications to generate dynamic contents Specify the encoding of data passed to programs Allow HTML documents to be created on the fly Transparent to clients Client sends regular HTTP request Web server receives HTTP request, runs CGI program, and sends contents back in HTTP responses CGI programs can be written in any language 10CSC8304 – Computing Environments for Bioinformatics - Lecture 10

CGI Diagram 11 Web Server Script Document HTTP request HTTP response spawn process CSC8304 – Computing Environments for Bioinformatics - Lecture 10

HTML File format that describes a webpage Can be written by hand, or generated by a program A good way to generate a HTML file is by writing a Perl script CSC8304 – Computing Environments for Bioinformatics - Lecture 1012

13 HTML Example Some Document Some Topics This is an HTML document This is another paragraph CSC8304 – Computing Environments for Bioinformatics - Lecture 10

14 HTML Structure CSC8304 – Computing Environments for Bioinformatics - Lecture 10

What HTML is not Modern HTML is a descriptive language Tells what a element is, not how it’s displayed Layout, colour, font, style is given via Cascading Style Sheets (CSS) Dynamic webpages (e.g. changing with user input, updated in real-time, etc) are done using Javascript programs. CSC8304 – Computing Environments for Bioinformatics - Lecture 1015

16 Using Forms HTML forms are used to collect user input Data sent via HTTP request Server launches CGI script to process data Enter your query: CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Input types: text Text Fields used when you want the user to type letters, numbers, etc. in a form. 17 First name: Last name: How it looks in a browser: CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Input types: radio Radio Buttons used when you want the user to select one of a limited number of choices. How it looks in a browser: 18 Male Female CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Input Types: checkbox Checkboxes used when you want the user to select one or more options of a limited number of choices. How it looks in a browser: 19 I have a bike: I have a car: I have an airplane: CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Input Types: textarea Text area defines a multi-line text input field, the size of a textarea can be specified by the cols and rows attributes. How it looks in a browser: 20 You can add any text in this space that can then be edited by the user. (or just leave it empty) CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Submit Button Submits the form for processing by the CGI script specified in the form tag 21CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Parsing Form Input Easily done using Perl’s CGI.pm module use CGI qw(:standard); Fields can be queried by the following: For single values: $value = param(“fieldname”); For multiple values = param(“fieldname”); All printed output is sent to the user’s web browser. 22CSC8304 – Computing Environments for Bioinformatics - Lecture 10

CGI Script: Example 23CSC8304 – Computing Environments for Bioinformatics - Lecture 10

24 Part 1: HTML Form Experiment recorder Record an experiment Experiment complete? Yes No Initial species concentrations: Name Concentration Observations: CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Part 2: CGI Script (Perl) 25 #!/usr/bin/perl -w use strict; use CGI qw(:standard); # Prints everything until the line with an END print <<END; Content-Type: text/html; charset=iso Form Result Results are: END my $complete = param('complete'); my %species_conc; $species_conc{param('species1')} = param('conc1'); $species_conc{param('species2')} = param('conc2'); my $observations = param('obs'); CSC8304 – Computing Environments for Bioinformatics - Lecture 10

Part 2: CGI Script (Perl) continued 26 if ($complete eq "yes") { print "The experiment was complete"; } else { print "The experiment did not finish"; } print " \n"; foreach my $key (keys %species_conc) { print "$key at concentration ". $species_conc{$key}. " \n"; } print " \n"; print "Observations: $observations"; print <<END; END CSC8304 – Computing Environments for Bioinformatics - Lecture 10

27 Summary Network protocols HTML and input types CGI Using Perl for CGI scripts CSC8304 – Computing Environments for Bioinformatics - Lecture 10