Beruflich Dokumente
Kultur Dokumente
Laboratory 1
Web Architecture
by
Tony WONG
8/2/2010
Network Interface
Internet
Overview of Web Architecture
HTML
Interpreter
input
from Output
Controller JavaScript sent to
user Interpreter
(e.g. URL) display
Other
IInterpreter
t t
Network Interface
www
Client
Internet
Web
Server
OK. ABC.html
How can the Client program and Web Server
Program Understand Each Other
HTML
Interpreter
input
from Output
Controller JavaScript
user sent to
Interpreter
(e.g. URL) display
Web Server
Other (HTTPD)
Interpreter
Network Interface
Internet
HTTP Properties
In pure HTML web page, the content and layout did not
change.
Question: How can we write a web page that return the
Q
result of adding two numbers input by a user?
Question: How can you retrieve the book title and author
from a library database based on the call number input by
the user?
Dynamic i Webb Pages: all
ll or part off the
h HTML file
fil is
i
dynamically generated by a programming language.
Th program can be
The b run on the
th Client
Cli t or the
th Server
S
Client-Side Scripting
Server-Side Scripting
<html>
h l
<body>
Sample0104.php
<html>
<body>
The result is <br>
<?php
$sum = $_GET[
$ GET['firstno']
firstno ] + $_GET[
$ GET['secondno'];
secondno ];
$display = "The total of ".$_GET['firstno']." and ".$_GET['secondno']." is ".$sum;
pprint $display;
p y;
?>
</body>
</html>
Actual HTML Sent to Browser
<html>
y
<body>
The result is <br>
The total of 4 and 5 is 9</body>
</html>
Server-Side Scripting
Web Server Machine
Hello.php
<HTML>
<?php
PHP
print ("<B>Hello</B>");
Interpreter
?>
</HTML>
Interprets PHP Code
<HTML>
Web <B>Hello</B>
Server </HTML>
HTTP Request
http://abc.com/hello.php
Hello
Interaction with Database Server
Web Server Machine
book.php
<HTML>
<?php
? h
PHP MySQL
mysql_query("select name from
Interpreter Database
books where isbn=1234");
Server
Print ("$name");
?>
</HTML> Interprets PHP Code
<HTML>
Napoleon
p Database
Web </HTML>
Server
HTTP Request
http://abc.com/book.php
Napoleon