Programming the World Wide Web 8th Edition Robert W. Sebestapdf download
Programming the World Wide Web 8th Edition Robert W. Sebestapdf download
https://ebookmass.com/product/programming-the-world-wide-web-8th-
edition-robert-w-sebesta/
https://ebookmass.com/product/concepts-of-programming-languages-10th-
edition-sebesta/
https://ebookmass.com/product/history-disrupted-how-social-media-and-
the-world-wide-web-have-changed-the-past-jason-steinhauer/
https://ebookmass.com/product/customer-service-skills-for-success-8th-
edition-robert-w-lucas/
https://ebookmass.com/product/introducing-rescript-functional-
programming-for-web-applications-1st-edition-danny-yang/
The King in Yellow Robert W Chambers
https://ebookmass.com/product/the-king-in-yellow-robert-w-chambers-2/
https://ebookmass.com/product/the-king-in-yellow-robert-w-chambers/
https://ebookmass.com/product/c-programming-8th-ed-edition-d-s/
https://ebookmass.com/product/mips-assembly-language-programming-
robert-britton/
https://ebookmass.com/product/php-8-basics-for-programming-and-web-
development-gunnard-engebreth/
Progr ammi n g T h e
W orld W ide W eb
Ei ghth Edi ti on
RO B E R T W. S E B E S TA
University of Colorado at Colorado Springs
Boston Columbus Indianapolis New York San Francisco Upper Saddle River
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto
Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
Vice President/Editorial Director: Marcia Horton Cover Art: © Palsur/Shutterstock
Executive Editor: Matt Goldstein Full-Service Project Management: Vasundhara
Editorial Assistant: Kelsey Loanes Sawhney/Cenveo® Publisher Services
Senior Managing Editor: Scott Disanno Composition: Cenveo Publisher Services
Program Manager: Kayla Smith-Tarbox Printer/Binder: R.R. Donnelley—Harrisonburg
Project Manager: Irwin Zucker Cover Printer: R.R. Donnelley—Harrisonburg
Art Director: Jayne Conte Text Font: JansonText
Cover Designer: Bruce Kenselaar
Copyright © 2015, 2013, 2011, 2010 Pearson Education, Inc. All rights reserved. Manufactured in the United
States of America. This publication is protected by Copyright, and permission should be obtained from the
publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or
by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use
material from this work, please submit a written request to Pearson Education, Inc., Permissions Department,
One Lake Street, Upper Saddle River, New Jersey 07458.
Microsoft and/or its respective suppliers make no representations about the suitability of the information contained in the
documents and related graphics published as part of the services for any purpose. All such documents and related graphics
are provided “as is” without warranty of any kind. Microsoft and/or its respective suppliers hereby disclaim all warranties
and conditions with regard to this information, including all warranties and conditions of merchantability, whether express,
implied or statutory, fitness for a particular purpose, title and non-infringement. In no event shall microsoft and/or its
respective suppliers be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss
of use, data or profits, whether in an action of contract, negligence or other tortious action, arising out of or in connection
with the use or performance of information available from the services. The documents and related graphics contained herein
could include technical inaccuracies or typographical errors. Changes are periodically added to the information herein.
Microsoft and/or its respective suppliers may make improvements and/or changes in the product(s) and/or the program(s)
described herein at any time. Partial screen shots may be viewed in full within the software version specified.
Trademarks
Microsoft® Windows®, and Microsoft Office® are registered trademarks of the microsoft corporation in the U.S.A.
And other countries. This book is not sponsored or endorsed by or affiliated with the microsoft corporation.
Many of the designations by manufacturers and seller to distinguish their products are claimed as trademarks.
Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations
have been printed in initial caps or all caps.
Credits for illustrations appear on page xx.
10 9 8 7 6 5 4 3 2 1
ISBN-10: 0-13-377598-4
ISBN-13: 978-0-13-377598-3
To Aidan
This page intentionally left blank
Preface
It is difficult to overestimate the effect the World Wide Web has had on
the day-to-day lives of people, at least those in the developed countries.
In just 20 years, we have learned to use the Web for a myriad of disparate
tasks, ranging from the mundane task of shopping for airline tickets to the
crucial early-morning gathering of business news for a high-stakes day trader.
The speed at which millions of Web sites appeared in the last two decades
would seem to indicate that the technologies used to build them were sitting
on the shelf, fully developed and ready to use, even before the Web appeared.
Also, one might guess that the tens of thousands of people who built those
sites were sitting around unemployed, waiting for an opportunity and already
possessing the knowledge and abilities required to carry out this mammoth
construction task when it appeared. Neither of these was true. The need for
new technologies was quickly filled by a large number of entrepreneurs, some
at existing companies and some who started new companies. A large part of
the programmer need was filled, at least to the extent to which it was filled,
by new programmers, some straight from high school. Many, however, were
previously employed by other sectors of the software development industry.
All of them had to learn to use new languages and technologies.
A visit to a bookstore, either a bricks-and-mortar store or a Web site,
will turn up a variety of books on Web technologies aimed at the practic-
ing professional. One difficulty encountered by those teaching courses in
Web programming technologies in colleges is the lack of textbooks that are
targeted to their needs. Most of the books that discuss Web programming
were written for professionals, rather than college students. Such books are
written to fulfill the needs of professionals, which are quite different from
those of college students. One major difference between an academic book
and a professional book lies in the assumptions made by the author about
the prior knowledge and experience of the audience. On the one hand, the
backgrounds of professionals vary widely, making it difficult to assume much
of anything. On the other hand, a book written for junior computer science
majors can make some definite assumptions about the background of the
reader.
v
vi Preface
This book is aimed at college students, not necessarily only computer science
majors, but anyone who has taken at least two courses in programming. Although
students are the primary target, the book is also useful for professional program-
mers who wish to learn Web programming.
The goal of the book is to provide the reader with a comprehensive introduc-
tion to the programming tools and skills required to build and maintain server
sites on the Web. A wide variety of technologies are used in the construction
of a Web site. There are now many books available for professionals that focus
on these technologies. For example, there are dozens of books that specifically
address only HTML. The same is true for at least a half-dozen other Web tech-
nologies. This book provides descriptions of many of the most widely used Web
technologies, as well as an overview of how the Web works.
The first seven editions of the book were used to teach a junior-level Web
programming course at the University of Colorado at Colorado Springs. The
challenge for students in the course is to learn to use several different program-
ming languages and technologies in one semester. A heavy load of programming
exercises is essential to the success of the course. Students in the course build a
basic, static Web site, using only HTML as the first assignment. Throughout the
remainder of the semester, they add features to their site as the new technologies
are introduced in the course. Our students’ prior course work in Java and data
structures, as well as C and assembly language, is helpful, as is the fact that many
of them have learned some HTML on their own before taking the course.
The most important prerequisite to the material of this book is a solid background
in programming in some language that supports object-oriented programming. It
is helpful to have some knowledge of a second programming language and a bit of
UNIX, particularly if a UNIX-based Web server is used for the course. Familiarity
with a second language makes learning the new languages easier.
Table of Contents
Chapter 1 lays the groundwork for the rest of the book. A few fundamentals are
introduced, including the history and nature of the Internet, the World Wide
Web, browsers, servers, URLs, MIME types, and HTTP. Also included in Chap-
ter 1 are brief overviews of the most important topics of the rest of the book.
Chapter 2 provides an introduction to HTML, including images, links, lists,
tables, forms, the audio and video elements, the organizational elements, and the
time element. Small examples are used to illustrate many of the HTML elements
that are discussed in this chapter.
The topic of Chapter 3 is cascading style sheets, which provide the standard
way of imposing style on the content specified in HTML tags. Because of the
size and complexity of the topic, the chapter does not cover all of the aspects of
style sheets. The topics discussed are levels of style sheets, style specification for-
mats, selector formats, property values, and color. Among the properties covered
are those for fonts, lists, and margins. Small examples are used to illustrate the
subjects that are discussed.
Chapter 4 introduces the core of JavaScript, a powerful language that could
be used for a variety of different applications. Our interest, of course, is its use
in Web programming. Although JavaScript has become a large and complex
language, we use the student’s knowledge of programming in other languages to
leverage the discussion, thereby providing a useful introduction to the language
in a manageably small number of pages. Topics covered are the object model of
JavaScript, its control statements, objects, arrays, functions, constructors, and
pattern matching.
Chapter 5 discusses some of the features of JavaScript that are related to
HTML documents. Included is the use of the basic and DOM 2 event and event-
handling model, which can be used in conjunction with some of the elements of
HTML documents. The HTML canvas element also is described.
One of the interesting applications of JavaScript is building dynamic HTML
documents with the Document Object Model (DOM). Chapter 6 provides
descriptions of a collection of some of the changes that can be made to documents
with the use of JavaScript and the DOM. Included are positioning elements;
moving elements; changing the visibility of elements; changing the color, style, and
size of text; changing the content of tags; changing the stacking order of overlapped
elements; moving elements slowly; and dragging and dropping elements.
Chapter 7 presents an introduction to XML, which provides the means to
design topic-specific markup languages that can be shared among users with
common interests. Included are the syntax and document structure used by XML,
namespaces, XML schemas, and the display of XML documents with both cascad-
ing style sheets and XML transformations. Also included is an introduction to
Web services and XML processors.
Chapter 8 introduces the Flash authoring environment, which is used to
create a wide variety of visual and audio presentations—in particular, those that
include animation. A series of examples is used to illustrate the development
processes, including drawing figures, creating text, using color, creating motion
viii Preface
and shape animations, adding sound tracks to presentations, and designing com-
ponents that allow the user to control the Flash movie.
Chapter 9 introduces PHP, a server-side scripting language that enjoys wide
popularity, especially as a database access language for Web applications. The
basics of the language are discussed, as well as the use of cookies and session track-
ing. The use of PHP as a Web database access language is covered in Chapter 13.
Chapter 10 introduces Ajax, the relatively recent technology that is used to
build Web applications with extensive user interactions that are more efficient
than those same applications if they do not use Ajax. In addition to a thorough
introduction to the concept and implementation of Ajax interactions, the chapter
includes discussions of return document forms, Ajax toolkits, and Ajax security.
Several examples are used to illustrate approaches to using Ajax.
Java Web software is discussed in Chapter 11. The chapter introduces the
mechanisms for building Java servlets and gives several examples of how servlets
can be used to present interactive Web documents. The NetBeans framework
is introduced and used throughout the chapter. Support for cookies in servlets
is presented and illustrated with an example. Then JSP is introduced through a
series of examples, including the use of code-behind files. This discussion is fol-
lowed by an examination of JavaBeans and JavaServer Faces, along with examples
to illustrate their use.
Chapter 12 is an introduction to ASP.NET, although it begins with a brief
introduction to the .NET Framework and C#. ASP.NET Web controls and some
of the events they can raise and how those events can be handled are among the
topics discussed in this chapter. ASP.NET AJAX is also discussed. Finally, con-
structing Web services with ASP.NET is introduced. Visual Studio is introduced
and used to develop all ASP.NET examples.
Chapter 13 provides an introduction to database access through the Web. This
chapter includes a brief discussion of the nature of relational databases, architectures
for database access, the structured query language (SQL), and the free database
system MySQL. Then, three approaches to Web access to databases are discussed:
using PHP, using Java JDBC, and using ASP.NET. All three are illustrated with
complete examples. All of the program examples in the chapter use MySQL.
Chapter 14 introduces the development of Android applications. The basics
of view documents, which are written in an XML-based markup language, and
activities, which are written in a form of Java, are introduced. Several relatively
simple examples are used to illustrate this new approach to building Web applica-
tions for mobile devices.
Chapter 15 introduces the Ruby programming language. Included are the
scalar types and their operations, control statements, arrays, hashes, methods,
classes, code blocks and iterators, and pattern matching. There is, of course, much
more to Ruby, but the chapter includes sufficient material to allow the student to
use Ruby for building simple programs and Rails applications.
Chapter 16 introduces the Rails framework, designed to make the construc-
tion of Web applications relatively quick and easy. Covered are simple document
requests, both static and dynamic, and applications that use databases, including
the use of scaffolding.
Preface ix
Appendix A introduces Java to those who have experience with C++ and
object-oriented programming, but who do not know Java. Such students can learn
enough of the language from this appendix to allow them to understand the Java
applets, servlets, JSP, and JDBC that appear in this book.
Appendix B is a list of 140 named colors, along with their hexadecimal
codings.
Support Materials
Supplements for the book are available at the Pearson Web site
www.pearsonhighered.com/sebesta. Support materials available to all readers
of this book include
• A set of lecture notes in the form of PowerPoint files. The notes were
developed to be the basis for class lectures on the book material.
• Source code for examples
Additional support material, including solutions to selected exercises
and figures from the book, are available only to instructors adopting this
textbook for classroom use. Contact your school’s Pearson Education
representative for information on obtaining access to this material, or visit
pearsonhighered.com.
Software Availability
Most of the software systems described in this book are available free to students.
These systems include browsers that provide interpreters for JavaScript and parsers
for XML. Also, PHP, Ruby, and Java language processors, the Rails framework, the
Java class libraries to support servlets, the Java JDBC, and the Android Development
system, are available and free. ASP.NET is supported by the .NET software
available from Microsoft. The Visual Web Developer 2013, a noncommercial
version of Visual Studio, is available free from Microsoft. A free 30-day trial version
of the Flash development environment is available from Adobe.
A new section was added to Chapter 7, titled Uses of XML, which briefly
describes some of the many areas in which XML has been used. Section 7.4, titled
Document Type Definitions, was deleted in its entirety.
A new section, titled Attributes, which describes the attributes of C# was
added to Chapter 12.
A completely new chapter was added to the book, Chapter 14, titled Android
Software Development, which introduces the structure of Android applications
and the process of developing them. The use of intents to call other activities and
data persistence are also discussed.
Throughout the book, numerous small revisions, additions, and deletions
were made to improve the correctness and clarity of the material.
Preface xi
Acknowledgments
The quality of this book was significantly improved as a result of the extensive
suggestions, corrections, and comments provided by its reviewers. It was reviewed
by the following individuals:
Matt Goldstein, Executive Editor; Kelsey Loanes, Editorial Assistant, and Kayla
Smith-Tarbox, Program Manager, all deserve my gratitude for their encouragement
and help in completing the manuscript.
Brief Contents
1 Fundamentals 1
2 Introduction to HTML/XHTML 33
Index 741
xii
Contents
1 Fundamentals 1
1.1 A Brief Introduction to the Internet 2
1.2 The World Wide Web 6
1.3 Web Browsers 7
1.4 Web Servers 8
1.5 Uniform Resource Locators 11
1.6 Multipurpose Internet Mail Extensions 13
1.7 The Hypertext Transfer Protocol 15
1.8 Security 18
1.9 The Web Programmer’s Toolbox 20
Summary 27
Review Questions 29
Exercises 31
2 Introduction to HTML/XHTML 33
2.1 Origins and Evolution of HTML and XHTML 34
2.2 Basic Syntax 38
2.3 Standard HTML Document Structure 39
2.4 Basic Text Markup 40
2.5 Images 49
2.6 Hypertext Links 55
2.7 Lists 58
2.8 Tables 63
2.9 Forms 69
2.10 The audio Element 83
2.11 The video Element 84
2.12 Organization Elements 86
2.13 The time Element 88
2.14 Syntactic Differences between HTML and XHTML 89
xiii
xiv Contents
Summary 90
Review Questions 91
Exercises 93
Index 741
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
So well as I am; I can tell thee that
Will please thee, for when all else left my cause,
My very adversaries took my part.
Enter Lawyers.
Long. Here come they
Whose very countenances will tell you how
Contemptible it is to others.
Mont. Sir?
Long. Dog him you Bloud-hound: by this point thou shalt more
safely dog an angry Lion, than attempt him.
Mont. What's the matter?
Mont. No my child,
I will not; that would discommend th' intent
Of all my other actions: thou art yet
Unable to advise thy self a course,
Should I put thee to seek it; after that
I must excuse, or at the least forgive
Any [un]charitable deed that can be done against my self.
Ver. Every day (my Lord) I tarry with you, I'll account
A day of blessing to me; for I shall
Have so much less time left me of my life
When I am from you: and if misery
Befall you (which I hope so good a man
Was never born to) I will take my part,
And make my willingness increase my strength
To bear it. In the Winter I will spare
Mine own cloth[e]s from my self to cover you;
And in the Summer, carry some of yours
To ease you: I'll doe any thing I can.
Lady. Ye are the owner Sir of every thing that does belong to me.
Orl. No, not of him, sweet Lady.
Enter Amiens.
Orl. Who comes there?
La. My brother.
Orl. Is he distracted.
Orl. 'Tis a change; thou shalt behold it: then observe me when
That Montague had possession of my Land,
I was his rivall, and at last obtain'd
This Lady who, by promise of her own
Affection to him, should ha' bin his wife;
I had her, and withheld her like a pawn,
Till now my Land is rend'red to me again,
And since it is so, you shall see I have
The conscience not to keep her—give him her— [draws.
For by the faithfull temper of my sword, she shall not tarry with me.
Am. Montague?
Mont. Sir.
Mont. You lye, and shall lie lower if you dare abuse her honor.
Enter Lady.
La. I am honest.
Am. Honest!
Mont. Why Madam? are you utterly without means to relieve you?
La. I have nothing Sir, unless by changing of these cloaths for worse,
and then at last the worst for nakedness.
Mont. Stand off boy, nakedness would be a change
To please us Madam, to delight us both.
Dub. Let the plot be thine, and in the enterprize I'll second thee.
ebookmasss.com