Overview of Client Side and Server Side...

26
Overview of ClientSide and ServerSide Interactivity CGT 356 Web Programming, Development, & Database Integration 1 CGT 356 Copyright © 2002-Present Ronald J. Glotzbach

Transcript of Overview of Client Side and Server Side...

Page 1: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Overview of Client‐Side and Server‐Side Interactivity

CGT 356 Web Programming, Development, & Database

Integration

1CGT 356 Copyright © 2002-Present Ronald J. Glotzbach

Page 2: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side Technologies• Client – Side

• Server – Side

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 2

Page 3: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Client‐Side• Def: Applications that run on a user’s

machine and need a server to do some processing

• Typically refer to a user’s computer as the cliento A student browsing the web is an example

• Any web browser, such as Chrome, is a client application that runs on a client machineo Chrome interprets HTML on the client machine,

thus HTML is a client-side technology

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 3

Page 4: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Client‐Side• Prerequisite for this course dealt primarily

with client-side technologies• Other client-side technologies

o HTML & HTML5o JavaScript & jQuery (anything JavaScript based)o VBScripto Jscripto Javao XML & XSLo ActiveXo Flasho Soundo There are more

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 4

Page 5: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side• Def: Some event that occurs on the server of

a client-server system.• Servers typically reside in a dungeon deep

below the earth’s surface with guys like Egormonitoring them.o Yes Master, Yes Master… I’ll install the ISAPI filter

to enrich our web content so that it will be dynamically driven… Yes MasterBut Egor has geek glasses, you know those thick black frames with tape in the middle… And he’s walkin around like Yes Master… Look for him on campus

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 5

Page 6: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)• Servers reside in a room and are usually not seen

o Temperature regulatedo Cables galore

• Usually do not ‘use’ a server once it is set up

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 6

Page 7: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)• Typically referred to as back-end technologies

o Depends on the context• HTML could be the front end generated by an PHP back-end• PHP could be the front-end with a database backend

o When you say this, you are typically talking about PHP generating the HTML front-end

• Other Server-Side Technologieso PHPo ASP.NETo JSPo CGIo ISAPI (Microsoft)o Databases o There are many, many, many more…

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 7

Page 8: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)• Languages that can be used on server-side

technologieso Javao PHPo VBo VBScripto XML / XSLo JavaScripto Co C++o SQLo C#o Perlo Many many more

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 8

Page 9: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)• This class will focus primarily on

o PHP (the pages you create)

o Databases (SQL) (the data you deliver to the browser)• MySQL (the specific database management system we use)

o XML (a ubiquitous transfer language for Web and other means

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 9

Page 10: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 10

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

ActiveXCLIENT SCRIPT

ENGINE

HTMLPHP ASP

ASPXJSP

IIS SERVER

EXTENSIONS

HTTP RESPONSE

HTTP GET

PROCESSSCRIPT

RETRIEVEPAGE

PROCESSPAGE

Page 11: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 11

C L I E N T S E R V E R

WEBBROWSER

Page 12: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 12

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

HTTP GET

Page 13: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 13

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

HTMLPHP ASP

ASPXJSP

HTTP GET

RETRIEVEPAGE

Page 14: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 14

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

HTMLPHP ASP

ASPXJSP

IIS SERVER

EXTENSIONS

HTTP GET

RETRIEVEPAGE

PROCESSPAGE

Page 15: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 15

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

HTMLPHP ASP

ASPXJSP

IIS SERVER

EXTENSIONS

HTTP RESPONSE

HTTP GET

RETRIEVEPAGE

PROCESSPAGE

Page 16: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 16

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

ActiveXCLIENT SCRIPT

ENGINE

HTMLPHP ASP

ASPXJSP

IIS SERVER

EXTENSIONS

HTTP RESPONSE

HTTP GET

PROCESSSCRIPT

RETRIEVEPAGE

PROCESSPAGE

Page 17: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Server‐Side (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 17

C L I E N T S E R V E R

WEBBROWSER

MICROSOFTINTERNET

INFORMATIONSERVER

ActiveXCLIENT SCRIPT

ENGINE

HTMLPHP ASP

ASPXJSP

IIS SERVER

EXTENSIONS

HTTP RESPONSE

HTTP GET

PROCESSSCRIPT

RETRIEVEPAGE

PROCESSPAGE

Page 18: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Prerequisites• In the prerequisite course, we dealt with

some JavaScript

• Client-Side<script type="text/javascript“>

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 18

Page 19: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Prerequisites (cont.)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 19

C L I E N T

WEBBROWSER

ActiveXCLIENT SCRIPT

ENGINE

PROCESSSCRIPT

Processing takes placeAFTER the page is sent to the client

Page 20: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

In contrast, on the Server‐Side

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 20

S E R V E R

MICROSOFTINTERNET

INFORMATIONSERVER

IIS SERVER

EXTENSIONS

PROCESSPAGE

Processing takes placeBEFORE the page is sent to the client

Using the same JavaScript Example<script type=”text/javascript”

runat=”server” >

Then the resulting HTML is sent to the Client

Page 21: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

A Closer Look at the Server‐Side

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 21

IISINTERNETSERVICES

ISAPIAPI

CGIAPI

ISAPIAPPLICATION

CGIAPPLICATION

ISAPIFILTERS

CLIENT

INTERNET INFORMATION SERVER

Dynamic LinkedLibrariesA better way

Inherently slow because CGI apps run outside of IIS

HTTP, FTP, GOPHER

Determine the type of API

A chunk of code that executes when a request is made

Page 22: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

ISAPI• Internet Server Application Program Interface

• Enables programmers to build Web applications that run much faster than conventional CGI applications because they are more tightly integrated with the Web server.

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 22

Page 23: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

API• Application Program Interface

• A set of stored routines, protocols, and tools for building software applications. (The building blocks for software development)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 23

Page 24: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

CGI Disadvantages• If your web server is Windows:

o CGI applications are a separate process from IIS

o A new CGI application process is started each time a request is made for its service

o Data cannot be shared between requests

o Because of this, CGI is slow

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 24

Page 25: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Advantages of PHP• Data can be persisted and shared

between requests• It has a low learning curve and is easy to

program• Not constrained by client-side

applications• ODBC can link to any data source

o ODBC: Open Database Connectivity

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 25

Page 26: Overview of Client Side and Server Side Interactivitycgtweb1.tech.purdue.edu/courses/cgt356/Private/Notes/Lecture02_1… · • Prerequisite for this course dealt primarily with client-side

Disadvantages of PHP• It is an interpreted language, which means there is

no compilation of code

• Debugging can be trial and error, but web browsers are pretty good about displaying messages

• It uses a scripting language, and does not use an OO programming language (although it is possible to write object oriented scripts)

CGT 356 Copyright © 2002-Present Ronald J. Glotzbach 26