Lecture 11 Server Side Interaction

Slides:



Advertisements
Similar presentations
Web forms and CGI scripts Dr. Andrew C.R. Martin
Advertisements

Other Web Application Development Technologies. PHP.
E-Commerce CMM503 – Lecture 8 Stuart Watt Room C2.
Overview Environment for Internet database connectivity
Copyright © 2004 ProsoftTraining, All Rights Reserved. Lesson 11: Advanced Web Technologies.
Lecture plan Information retrieval (from week 11)
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
DT228/3 Web Development WWW and Client server model.
Web 2.0 with AJAX Students : LASC Ioana KELEMEN Csilla POP Dan Adrian CIOBANU Dumitru Daniel Project leaders : Jean Luc LARBOT Ahmed RHIAT.
Languages for Dynamic Web Documents
Kyung Hee University 1 1 Application Layer. 2 Kyung Hee University Position of Application Layer.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
28/1/2001 Seminar in Databases in the Internet Environment Introduction to J ava S erver P ages technology by Naomi Chen.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Server Side Web Technologies: Part 2.
DT211/3 Internet Development Application Internet Development Application.
Week 2 IBS 685. Static Page Architecture The user requests the page by typing a URL in a browser The Browser requests the page from the Web Server The.
Dynamic Web Pages Bert Wachsmuth. Review  Internet, IP addresses, ports, client-server, http, smtp  HTML, XHTML, XML  Style Sheets, external, internal,
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.
Java Server Team 8. Overview What is a Java Server? History Architecture Advantages Disadvantages Current Technologies Conclusion.
Guide To UNIX Using Linux Third Edition
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
1 Java Server Pages Can web pages be created specially for each user? What part does Java play?
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Server Side Scripting Norman White. Where do we do processing? Client side – Javascript (embed code in html) – Java applets (send java program to run.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DATABASE PROGRAMMING
M. Taimoor Khan * Java Server Pages (JSP) is a server-side programming technology that enables the creation of dynamic,
Server- Side technologies Client-side vs. Server-side scripts PHP basic ASP.NET basic ColdFusion.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
Architecture Of ASP.NET. What is ASP?  Server-side scripting technology.  Files containing HTML and scripting code.  Access via HTTP requests.  Scripting.
Introduction to ASP.NET. Prehistory of ASP.NET Original Internet – text based WWW – static graphical content  HTML (client-side) Need for interactive.
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.
16-1 The World Wide Web The Web An infrastructure of distributed information combined with software that uses networks as a vehicle to exchange that information.
Web Application Programming Carol Wolf Computer Science.
Chapter 17 - Deploying Java Applications on the Web1 Chapter 17 Deploying Java Applications on the Web.
CP476 Internet Computing CGI1 CGI is a common way to provide for specific computations on server side, interactions with users, or access to databases.
1 In the good old days... Years ago… the WWW was made up of (mostly) static documents. –Each URL corresponded to a single file stored on some hard disk.
Sheet 1XML Technology in E-Commerce 2001Lecture 1 XML Technology in E-Commerce Lecture 1 WWW, HTML, CSS, XML, Meta-modeling.
HTML. Principle of Programming  Interface with PC 2 English Japanese Chinese Machine Code Compiler / Interpreter C++ Perl Assembler Machine Code.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
Introducing ASP.NET 2.0. Internet Technologies WWW Architecture Web Server Client Server Request Response Network HTTP TCP/IP PC/Mac/Unix + Browser (IE,
1 MSCS 237 Overview of web technologies (A specific type of distributed systems)
Overview of Form and Javascript fundamentals. Brief matching exercise 1. This is the software that allows a user to access and view HTML documents 2.
Web Pages with Features. Features on Web Pages Interactive Pages –Shows current date, get server’s IP, interactive quizzes Processing Forms –Serach a.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
CITA 310 Section 7 Installing and Testing a Programming Environment (Textbook Chapter 7)
Module: Software Engineering of Web Applications Chapter 2: Technologies 1.
CS562 Advanced Java and Internet Application Introduction to the Computer Warehouse Web Application. Java Server Pages (JSP) Technology. By Team Alpha.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
Introduction and Principles Web Server Scripting.
Asstt. Prof Sonia Sharma Computer Dept 1 HTML ( Hypertext MarkUP Language ) HTML is the lingua franca for publishing hypertext on the World Wide Web.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
Web Design Terminology Unit 2 STEM. 1. Accessibility – a web page or site that address the users limitations or disabilities 2. Active server page (ASP)
A S P. Outline  The introduction of ASP  Why we choose ASP  How ASP works  Basic syntax rule of ASP  ASP’S object model  Limitations of ASP  Summary.
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.
Java Server Pages Can web pages be created specially for each user?
JavaScript and Ajax (Ajax Tutorial)
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 1 Introduction to HTML.
Introduction and Principles
PHP / MySQL Introduction
MSIS 655 Advanced Business Applications Programming
Chapter 27 WWW and HTTP.
Presentation transcript:

Lecture 11 Server Side Interaction Boriana Koleva Room: C54 Email: bnk@cs.nott.ac.uk

Overview Purpose of Server-Side Scripting Example Server-Side Technologies: Server-Side Includes CGI Perl Java Servlets and Java Server Pages ASP.NET Embedded Scripts PHP Ajax

World Wide Web HTTP Server Client HTTP HTML data Software on Server Request (inc. form data) Response (HTML doc) HTML data Software on Server Database

Examples of Server Side Applications Search systems Document management systems User registration/administration/profiles Transactions E-commerce

SSI – Server Side Includes Instructions to the server embedded in HTML File extension of .shtml is usually used Server must be SSI enabled SSI instructions in HTML Comments <!-- This is a comment --> SSI instructions preceded by hash ( # ) <!--#include virtual=myfile.html--> This includes the file “myfile.html” in the main XHTML file http://scarlet.cs.nott.ac.uk/~bnk/WPS/demoSSI.shtml

Demo SSI code <h2> Server Side Includes </h2> <p> This is the main file (demoSSI.shtml) - everything between the two horizontal lines is held in an external file (table.html). </p> <hr> <!--#include virtual="table.html"--> <p> This is the main file again </p>

Common Gateway Interface (CGI) CGI allows browsers to request the execution of server-resident software An HTTP request to run a CGI program specifies a program, rather than a document Servers can recognize such requests in two ways: 1. By the location of the requested file (special subdirectories for such files) 2. A server can be configured to recognize executable files by their file name extensions

CGI A CGI program can produce a complete HTTP response, or just the URL of an existing document CGI programs often are stored in a directory named cgi-bin CGI programs may be written in any language http://marian.cs.nott.ac.uk/~bnk/cgi-bin/demoCGI Most major languages have CGI libraries PERL is the most commonly used language for CGI

demoCGI code #!/bin/sh echo Content-type: text/html echo echo "<html>" echo "<head> <title> A simple CGI demonstration </title> </head>" echo "<body>" echo "<h1> A simple CGI demo </h1>" echo "<p> The time is now:" date echo "</p>" echo "<pre>" cal echo "</pre>" echo "</body>" echo "</html>"

CGI Some CGI programs are in machine code, but Perl programs are usually kept in source form, so perl must be run on them A source file can be made to be “executable” by adding a line at their beginning that specifies that a language processing program must be run on them first For Perl programs, if the perl system is stored in /usr/local/bin/perl, (as it usually is in UNIX systems) then this is: #!/usr/local/bin/perl

CGI An HTML document can specify a CGI program with the hypertext reference attribute, href, of the anchor tag, <a>, e.g.: <a href = “./cgi-bin/reply.cgi>” Click here to run the CGI program, reply.pl </a> But more commonly a CGI program is called when the Submit button of a form is clicked <form action = “reply.cgi” method = "post">

Perl PERL Interpreted programming language Ported to most platforms Practical Extraction and Report Language Interpreted programming language Ported to most platforms Originally intended primarily for Unix administrative tasks Exceptionally powerful text processing

Perl Derived from C, AWK, Lisp and many other languages Extensive support for regular expressions Standard set of text matching and manipulation expressions Only primitive data type is a “scalar” Scalars can hold numbers, strings or typed data Arrays are indexed by scalars Associative arrays Object Oriented “modules” E.g. for CGI programming http://www.cs.nott.ac.uk/~bnk/WPS/popcorn.html http://www.cs.nott.ac.uk/~bnk/WPS/popcorn.txt (perl code)

Java Servlets A servlet is a compiled Java class Servlets are executed on the server system under the control of the Web server Servlets are managed by the servlet container (also called servlet engine) Servlets are called through HTML Servlets receive requests and return responses, both of which are supported by the HTTP protocol

Java Servlets When the Web server receives a request that is for a servlet, the request is passed to the servlet container The container makes sure the servlet is loaded and calls it The servlet call has two parameter objects, one with the request and one for the response When the servlet is finished, the container reinitializes itself and returns control to the Web server

Java Servlet Advantages Can be faster than CGI, because they can run in the server process Have direct access to Java APIs Because they continue to run (unlike CGI programs), they can save state information Have the usual benefits of being written in Java (platform independence, ease of programming)

JavaServer Pages (JSP) Released in 1999 as Sun's answer to ASP and PHP Architecturally, JSP may be viewed as a high-level abstraction of Java servlets Instead of embedding HTML in Java code, code is embedded in HTML to provide the dynamic parts JSP syntax is a fluid mix of two basic content forms: scriptlet elements and markup markup is typically standard HTML or XML scriptlet elements are delimited blocks of Java code which may be intermixed with the markup

JavaServer Pages (JSP) Because Java is a compiled not a scripting language, JSP pages must be compiled to Java bytecode classes before they can be executed JSPs are compiled into servlets by a JSP compiler So JSP is a simplified approach to writing servlets

.NET Framework .NET Framework is a collection of technologies for the development and deployment of .NET software systems pre-coded solutions form the framework's class library and cover a large range of programming needs Programs written for the .NET Framework execute in a software environment that manages the program's runtime requirements - Common Language Runtime (CLR) .NET languages from Microsoft: VB .NET, Managed C++ .NET, JScript .NET, J# .NET, C#

ASP.NET Set of web application development technologies part of Microsoft's .NET platform Code can be embedded in ASP.NET documents, or can be separate in a code-behind file Any .NET language can be used Every ASP.NET document is compiled into a class

Server-Side Embedded Scripts Many proprietary scripting systems Often included as connectivity kits for databases Sometimes as part of a dedicated web management system - e.g. Cold Fusion Scripts are embedded into HTML/XHTML HTML containing scripts is pre-processed, the scripts executed and the result served as standard HTML PHP (PHP Hypertext Pre-processor) Embedded “C-like” scripting language Platform independent Open Source Support for large number of databases (inc. MySQL)

Ajax (asynchronous JavaScript and XML) A group of technologies used on the client-side to create interactive web applications combination of HTML and CSS to mark up and style information The DOM is accessed with JavaScript to dynamically display, and to allow interactivity with, document elements JavaScript and the XMLHttpRequest object – method for exchanging data asynchronously between browser and server to avoid full page reloads

Ajax Diagram Initial request by the browser – the user requests a particular URL. The complete page is rendered by the server (along with the JavaScript AJAX engine) and sent to the client (HTML, CSS, JavaScript AJAX engine).  All subsequent requests to the server are initiated as function calls to the JavaScript engine.  The JavaScript engine then makes an XmlHttpRequest to the server.  The server processes the request and sends a response in XML format to the client (XML document). It contains the data only of the page elements that need to be changed. In most cases this data comprises just a fraction of the total page markup.  The AJAX engine processes the server response, updates the relevant page content or performs another operation with the new data received from the server. (HTML + CSS)

Summary Ajax Purpose of Server-Side Scripting Major Server-Side Technologies Server-Side Includes CGI Perl Java Servlets and JavaServer Pages ASP.NET Embedded Scripts PHP Ajax