interactive, it must be fault-tolerant, it’s limited by network speed bottlenecks, and it must work with generic browsers. The relatively recent Ajax technique relies heavily on client-side programming to deliver a more customized user interface. However, the basic building blocks remain the same.
The advantage of web software is its flexibility.
Any user, anywhere, with almost any browser on any platform, can use the software. Importantly,
no configuration is required, and training isn’t usually needed. Web software is predictable there area limited number of ways you can build an application, and most users have seen the paradigms before and know whereto start. With web software, deployment is as simple as setting up your web server,
installing scripts on it, and publishing the address of your web application page.
Figure 13-1 shows how web software works. When a user clicks on a link (or submits a form, or types a URL, a request is sent from her web browser to a web server identified by the URL. The web server extracts path,
resource, and other information from the
URL and uses this to identify what script to run and what parameters to give it. The script is then executed and its output sent to the browser, along with a status message that indicates whether the operation was successful. If the request was successful, then
(usually)
an HTML resource is displayed, and the request process starts again when the user makes her next click in their browser.
Consider an example. You’ve decided to build an online store and have started to write the scripts that compose the application. Suppose you’ve authored one script,
shop.php, which allows a user to add an item to his shopping cart. The script expects two parameters to capture what the user wants to purchase a productID
number that identifies the product, and a quantity value that is the amount of the product. The script outputs a success message
in HTML when everything works, and an error message in HTML when it doesn’t.
To test your
shop.php script, you can save it in a directory from which your Apache web server serves scripts (the document root. If you’re using a Linux or Mac OS X
system, you also need to make sure that the file can be read by everyone,
since the webDatabase
server softwareUser with web browser
Web database application
Web server software
Host running database and web servers
HTTP request
(request, including any form data)
HTTP response
(content, mostly HTML)
Figure 13-1. Running a web scriptShare with your friends: