"The network is the computer"
The network is the computer.
- Sun Microsystems

Building Dynamic Web Pages
Client-Server Architectures (Section 1.4)
Client-Side Scripting (Chapters 3 & 4)
Web Servers (Chapter 5)
Server-Side Processing (Chapters 6, 8 & 10)

Client/Server Architectures

Static Web Sites

Client-Side Processing

Server-Side Processing

Server-Side with a Database

Programs vs. Scripts
Computers only understand programs written in a specially designed machine language:
Machine language programs are hard to write.
They are machine-specific.
In contrast, high-level languages:
Are easier to write because they are modeled on well-understood human formalisms.
Require a program to translate them into machine language:
Compiler
Interpreter

Machine Language Examples

High-Level Language Example

Compilers

Interpreters
An interpreter decodes a script written in a high-level language, executing it on-the-fly.
Interpreted scripts tend to run more slowly than compiled programs.

Client/Server Technologies

James Gosling (1956- )
Java
1995
A hybrid of compilation and interpretation
Based on a                virtual machine
Designed for a heterogeneous, networked environment.

Client-Side Scripting
Example: An Acme Attack Planner
Technologies:
Forms     (http://www.w3schools.com/html/html_forms.asp)
JavaScript (http://www.w3schools.com/js)

HTML Forms

Form Input Boxes

Form Selection Lists

Form Radio Buttons

Form Check Boxes

Form Command/Reset Buttons

Post vs. Get

JavaScript
JavaScript is designed to add interactivity to HTML web pages:
Developed by Netscape
has a C/C++/Java-like syntax
JavaScript ≠ Java
It is not object-oriented.
It has limited capabilities.

HTML and JavaScript

HTML and JavaScript (cont.)

Script Functions

Script Functions

Script Functions (cont.)

Script Functions (cont.)

Script Functions (cont.)

Script Functions (cont.)

Script Functions (cont.)

Script Functions (cont.)

An Image Swapper

Slide 35

JavaScript Reference Material
JavaScript data types (Netscape 2.0):
Boolean true, false
Number:Integer 1, 0, 1, 2, 3
Number:Floating Point 3.141, -3.01, 36e9
Number:Octal 05, 06, 07, 010
Number:Hexadecimal 0x8, 0x9, 0xA, 0xB
String "cat", "dog", ""
Null null
A JavaScript Reference/Tutorial:
http://www.w3schools.com/js/

Client/Server Architectures

Web Servers
Computers running software that processes information requests from web clients
Web servers communicate with clients using the Hypertext Transfer Protocol (HTTP).
Web servers provide access to many information types, e.g.:
html, text, gif, postscript,…
front ends to applications

Hyper-Text Transfer Protocol
Web servers communicate with clients using HTTP:
Request Types, e.g.:
GET
POST
Response Types, e.g.:
200
404
The HTTP protocol is:
Stateless
Anonymous

HTTP – A Static Page

HTTP – Client-Side Processing

HTTP – Server-Side Processing

Tim Berners-Lee (1955- )
World Wide Web
The world's first web server (info.cern.ch) on Dec. 25, 1990.
Included the key elements of the WWW:
URL
HTTP
HTML

Virtual Document Tree
File system structure ≠ Virtual document tree
The server computer maintains a standard, hierarchical file system.
The server software provides access only to the files in its virtual document tree.

Handling Multiple Users
HTTP servers/Application processors must hand multiple client requests.
How to run application processes:
Within the server process itself
One separate server process per request
Some combination of the two (e.g., threads)

HTTPS
HTTPS is HTTP working over the secure sockets layer (SSL).
SSL provides:
Encryption
Authentication

Comparing IIS and Apache
Apache
Open Source
Most commonly used
Seen as more reliable and more secure
Internet Information Server
Microsoft
Better integration with ASP.Net
Nicer administration IDE

Client/Server Architectures

Server-Side Scripting
Examples:
Acme new user registration
Acme products table
Technologies:
.Net Framework (http://www.w3schools.com/ngws)
VB.Net   (http://msdn.microsoft.com/vbasic/)
ASP.Net (http://www.w3schools.com/aspnet)
ADO.Net (http://www.w3schools.com/aspnet/aspnet_dbconnection.asp)

.Net Framework
Microsoft’s network-oriented development architecture
Components:
Common language runtime
Class library

.Net vs. Java
Similar technologies
.Net (late 1990s/early 2000s)
Cleaner/newer implementation
Tightly integrated with Windows
Nicer IDEs
Java (mid-1990s)
Multi-platform
Loosely integrated with the OS
Java community process

VB.Net
Not just for GUIs anymore:
VB.Net != VB6
VB.Net @ Java
Compiled, server or client-side
Integrated with Microsoft’s .Net framework and development tools

VB.Net: Data Types

VB.Net: Control Structures

VB.Net: Procedures

ASP.Net
Active Server Pages
Component of the .Net framework
Supports dynamic web pages:
Web Forms (.aspx)
Rich & HTML server controls
Validation server controls
Web Services (.asmx)

ASP.Net Processing

ASP.Net vs. ASP
ASP is an older technology (1996).
ASP.Net:
Supports hybrid server/client-side event handlers
Separates HTML from “backing” code
Compiles its code

ASP.Net vs. JSP
ASP.Net
Microsoft platforms only
Widely used and supported
Supports multiple .Net languages
JSP
Multi-platform support
Less widely used
Java only

A Simple Example (cont.)

ASP.Net in VS.Net

Web Forms

Server Controls

Server Controls (cont.)

Validation Controls

Validation Controls (cont.)

Validation Controls (cont.)

Custom Validators

Custom Validators (cont.)

Event Handlers

Event Handlers (cont.)

Event Handlers (cont.)

Database Programming
The world of information technology revolves around databases.
Most database work is done through database application programs.
Approaches to database programming:
Embedded SQL commands
Database API
A new database language

Impedance Mismatch

ADO.Net
ActiveX Data Objects
Microsoft’s generic database API
Comparisons:
ADO.Net vs ODBC/JDBC
ADO.Net vs ADO

ADO.Net Example

ADO.Net Classes

SqlConnections
All interactions between the VB program and the database will be done through this object.
Connects should be closed when no longer needed.

SqlCommands
Commands are VB objects that represent standard SQL command as strings.
These strings are passed to the database to be executed.

DataSets/DataReaders
DataSets are a cache of the real database on the local machine.
They can contain tables resulting from many queries.
A DataReader is a forward-read-only version of DataSet.

SqlDataAdaptors
DataAdaptors mediate the communication between the DBMS tables and the VB program DataSet/DataReader(s)

ADO.Net Code

    ADO.Net Code (2)

    ADO.Net Code (3)

Database Updates

    Database Updates (2)

    Database Updates (3)