AJAX, Rich Internet Applications, and Web Development for Programmers

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

The practicing programmer's DEITEL® guide to AJAX, Rich Internet Applications, and web-application development This book applies the Deitel signature live-code approach to teaching Web 2.0 application development. The book presents concepts in the context of more than 180 fully tested programs (18,000+ lines of code), complete with syntax shading, detailed descriptions, and sample outputs. It features hundreds of tips that will help you build robust applications. Start with a concise introduction to XHTML, CSS, and JavaScript before rapidly moving on to more advanced client-side development with DOM, XML, AJAX, JSON, and other RIA technologies. Then proceed to server-side development with web servers, databases, PHP, Ruby on Rails, ASP.NET, JavaServer Faces, and web services. When you're finished, you'll have everything you need to build Web 2.0 applications. The DEITEL Developer Series is designed for practicing programmers. The series presents focused treatments of emerging technologies, including .NET, JavaTM, web services, Internet and web development, and more. Practical, example-rich coverage of: Web 2.0 XHTML, CSS, JavaScript DOM, XML, RSS AJAX-Enabled Rich Internet Applications JSON, Dojo, Script.aculo.us Adobe® Flash CS3 and Flex Web Servers (IIS and Apache) Database (SQL, MySQL, ADO.NET and Java DB) PHP, Ruby on Rails ASP.NET, ASP.NET AJAX JavaServer Faces (JSF) SOAP-Based Web Services in Java REST-Based Web Services in ASP.NET Mashups And more... Visit www.deitel.com to: Download code examples Check out the growing list of programming, Web 2.0, and software-related Resource Centers To receive updates on this book, subscribe to the free DEITEL® BUZZ ONLINE e-mail newsletter at www.deitel.com/newsletter/subscribe.html Read archived Issues of the DEITEL BUZZ ONLINE Contact [email protected] for information on corporate training courses delivered on-site worldwide Pre-Publication Reviewer Testimonials "This book is easily the most comprehensive resource of its kind I've seen yet." --Jesse James Garrett, Adaptive Path "A one-stop shop for learning the essentials of web programming."--Anand Narayanaswamy, ASPAlliance.com "Excellent for learning to develop standards-compliant web applications...takes you from the browser to the server and the database, covering web development across many programming languages."--Paul Vencill, MITRE, Inc. "Cements the browser as a first-class development platform."--Johnvey Hwang, Splunk, Inc. "Congratulations on this excellent work. The [Dive Into Web 2.0] chapter is simply astonishing! It's one of the better--if not the best--references on Web 2.0."--José Antonio González Seco, Parlamento de Andalucia "The CSS chapter is compact, concise, and full of useful info!"--Billy B. L. Lim, Illinois State University "One of the best introductions to JavaScript."--Raymond Wisman, Indiana University Southeast "A good introduction to the DOM; doesn't trip over cross-browser incompatibilities."--Eric Lawrence, Microsoft "Exceptionally clear Ajax tutorial; best I've reviewed! Great solutions for the very cool type-ahead and edit-in-place AJAX features. 'Libraries to Help Eliminate Cross-Browser Compatibility Issues' is fantastic. This book and your web sites will be often-visited resources (if not best practices in themselves)."--John Peterson, Insync and V.I.O. Inc. "Great chapter [on building Flash games]."--Jennifer Powers, University of Albany "A solid introduction to Adobe Flex with some very cool applications."--Matt Chotin, Adobe "A solid introduction to the capabilities and flexibilities of PHP. Inspired me to tighten up my own code! Easy to follow JSF development with database, Virtual Forms, and Google Maps."--John Peterson, Insync and V.I.O. Inc. "Excellent coverage of developing ASP.NET applications, with plenty of sample code."--Peter Bromberg, VOIP, Inc. "The web services chapter concludes a comprehensive education on Web 2.0. The examples go a long way to support the Web 2.0 mission of this book."--George Semeczko, Independent Consultant

Author(s): Paul J. Deitel, Harvey M. Deitel
Edition: 1
Publisher: Prentice Hall
Year: 2008

Language: English
Pages: 1019

AJAX, Rich Internet Applications, and Web Development for Programmers......Page 0
Contents......Page 6
Preface......Page 16
Before You Begin......Page 28
Part 1: Introduction......Page 29
1 Dive Into Web 2.0......Page 30
1.1 Introduction......Page 31
1.2 What Is Web 2.0?......Page 32
1.3 Search......Page 35
1.4 Content Networks......Page 40
1.5 User-Generated Content......Page 41
1.6 Blogging......Page 44
1.7 Social Networking......Page 47
1.8 Social Media......Page 51
1.9 Tagging......Page 54
1.10 Social Bookmarking......Page 56
1.11 Software Development......Page 57
1.12 Rich Internet Applications (RIAs)......Page 60
1.13 Web Services, Mashups, Widgets and Gadgets......Page 62
1.14 Location-Based Services......Page 65
1.15 XML, RSS, Atom, JSON and VoIP......Page 66
1.16 Web 2.0 Monetization Models......Page 67
1.17 Web 2.0 Business Models......Page 69
1.18 Future of the Web......Page 72
1.19 Where to Go for More Web 2.0 Information......Page 76
1.20 Web 2.0 Bibliography......Page 77
1.21 Web 2.0 Glossary......Page 84
Part 2: The Ajax Client......Page 94
2 Introduction to XHTML......Page 95
2.1 Introduction......Page 96
2.3 First XHTML Example......Page 97
2.5 Headings......Page 100
2.6 Linking......Page 101
2.7 Images......Page 104
2.8 Special Characters and Horizontal Rules......Page 107
2.9 Lists......Page 109
2.10 Tables......Page 112
2.11 Forms......Page 116
2.12 Internal Linking......Page 123
2.13 meta Elements......Page 126
2.14 Web Resources......Page 127
3 Cascading Style Sheets (CSS)......Page 128
3.1 Introduction......Page 129
3.2 Inline Styles......Page 130
3.3 Embedded Style Sheets......Page 131
3.4 Conflicting Styles......Page 134
3.5 Linking External Style Sheets......Page 137
3.6 Positioning Elements......Page 139
3.7 Backgrounds......Page 143
3.8 Element Dimensions......Page 144
3.9 Box Model and Text Flow......Page 146
3.10 Media Types......Page 150
3.11 Building a CSS Drop-Down Menu......Page 152
3.12 User Style Sheets......Page 154
3.14 Web Resources......Page 158
4 JavaScript: Introduction to Scripting......Page 159
4.1 Introduction......Page 160
4.2 Simple Program: Displaying a Line of Text in a Web Page......Page 161
4.3 Modifying Our First Program......Page 164
4.4 Obtaining User Input with prompt Dialogs......Page 169
4.6 Arithmetic......Page 175
4.7 Decision Making: Equality and Relational Operators......Page 176
4.8 Web Resources......Page 180
5 JavaScript: Control Statements I......Page 181
5.2 Control Statements......Page 182
5.3 if Selection Statement......Page 183
5.4 if…else Selection Statement......Page 184
5.5 while Repetition Statement......Page 188
5.6 Counter-Controlled Repetition......Page 189
5.7 Formulating Algorithms: Sentinel-Controlled Repetition......Page 191
5.8 Formulating Algorithms: Nested Control Statements......Page 194
5.9 Assignment Operators......Page 197
5.10 Increment and Decrement Operators......Page 198
5.11 Web Resources......Page 201
6 JavaScript: Control Statements II......Page 202
6.2 Essentials of Counter-Controlled Repetition......Page 203
6.3 for Repetition Statement......Page 205
6.4 Examples Using the for Statement......Page 209
6.5 switch Multiple-Selection Statement......Page 213
6.6 do…while Repetition Statement......Page 218
6.7 break and continue Statements......Page 220
6.8 Labeled break and continue Statements......Page 223
6.9 Logical Operators......Page 225
6.10 Web Resources......Page 230
7 JavaScript: Functions......Page 231
7.2 Program Modules in JavaScript......Page 232
7.4 Function Definitions......Page 233
7.5 Random Number Generation......Page 238
7.6 Example: Game of Chance......Page 243
7.7 Another Example: Random Image Generator......Page 250
7.8 Scope Rules......Page 251
7.9 JavaScript Global Functions......Page 254
7.10 Recursion......Page 255
7.11 Recursion vs. Iteration......Page 258
7.12 Web Resources......Page 259
8 JavaScript: Arrays......Page 260
8.2 Arrays......Page 261
8.3 Declaring and Allocating Arrays......Page 262
8.4 Examples Using Arrays......Page 263
8.5 Random Image Generator Using Arrays......Page 270
8.6 References and Reference Parameters......Page 271
8.7 Passing Arrays to Functions......Page 272
8.8 Sorting Arrays......Page 275
8.9 Multidimensional Arrays......Page 277
8.10 Building an Online Quiz......Page 281
8.11 Web Resources......Page 283
9 JavaScript: Objects......Page 284
9.2 Introduction to Object Technology......Page 285
9.3 Math Object......Page 288
9.4 String Object......Page 289
9.5 Date Object......Page 300
9.6 Boolean and Number Objects......Page 305
9.7 document Object......Page 306
9.8 window Object......Page 307
9.9 Using Cookies......Page 312
9.10 Multipage HTML and JavaScript Application......Page 316
9.11 Using JSON to Represent Objects......Page 324
9.12 Web Resources......Page 325
10 Document Object Model (DOM): Objects and Collections......Page 326
10.2 Modeling a Document: DOM Nodes and Trees......Page 327
10.3 Traversing and Modifying a DOM Tree......Page 330
10.4 DOM Collections......Page 341
10.5 Dynamic Styles......Page 343
10.6 Summary of the DOM Objects and Collections......Page 349
10.7 Web Resources......Page 350
11 JavaScript: Events......Page 351
11.2 Registering Event Handlers......Page 352
11.3 Event onload......Page 355
11.4 Event onmousemove, the event Object and this......Page 356
11.5 Rollovers with onmouseover and onmouseout......Page 361
11.6 Form Processing with onfocus and onblur......Page 366
11.7 Form Processing with onsubmit and onreset......Page 369
11.8 Event Bubbling......Page 371
11.9 More Events......Page 373
11.10 Web Resources......Page 374
12 XML and RSS......Page 375
12.2 XML Basics......Page 376
12.3 Structuring Data......Page 379
12.4 XML Namespaces......Page 386
12.5 Document Type Definitions (DTDs)......Page 389
12.6 W3C XML Schema Documents......Page 393
12.7 XML Vocabularies......Page 400
12.8 Extensible Stylesheet Language and XSL Transformations......Page 404
12.9 Document Object Model (DOM)......Page 413
12.10 RSS......Page 430
12.11 Web Resources......Page 438
13 Ajax-Enabled Rich Internet Applications......Page 439
13.1 Introduction......Page 440
13.2 Traditional Web Applications vs. Ajax Applications......Page 441
13.3 Rich Internet Applications (RIAs) with Ajax......Page 443
13.5 “Raw” Ajax Example Using the XMLHttpRequest Object......Page 445
13.6 Using XML and the DOM......Page 451
13.7 Creating a Full-Scale Ajax-Enabled Application......Page 455
13.8 Dojo Toolkit......Page 468
13.9 Web Resources......Page 477
Part 3: Rich Internet Application Client Technologies......Page 479
14 Adobe Flash CS3......Page 480
14.1 Introduction......Page 481
14.2 Flash Movie Development......Page 482
14.3 Learning Flash with Hands-On Examples......Page 484
14.4 Publishing Your Flash Movie......Page 500
14.5 Creating Special Effects with Flash......Page 501
14.6 Creating a Website Splash Screen......Page 513
14.8 Web Resources......Page 519
15 Adobe Flash CS3: Building an Interactive Game......Page 520
15.1 Introduction......Page 521
15.3 Objects in Flash......Page 523
15.4 Cannon Game: Preliminary Instructions and Notes......Page 525
15.6 Creating Moving Objects......Page 526
15.7 Adding the Rotating Cannon......Page 531
15.8 Adding the Cannonball......Page 533
15.9 Adding Sound and Text Objects to the Movie......Page 536
15.10 Adding the Time Counter......Page 537
15.11 Detecting a Miss......Page 539
15.12 Adding Collision Detection......Page 540
15.13 Finishing the Game......Page 543
15.14 ActionScript 3.0 Elements Introduced in This Chapter......Page 544
16 Adobe Flex 2 and Rich Internet Applications......Page 545
16.1 Introduction......Page 546
16.2 Flex Platform Overview......Page 547
16.3 Creating a Simple User Interface......Page 548
16.4 Accessing XML Data from Your Application......Page 559
16.5 Interacting with Server-Side Applications......Page 573
16.6 Customizing Your User Interface......Page 582
16.7 Creating Charts and Graphs......Page 586
16.8 Connection Independent RIAs on the Desktop: Adobe Integrated Runtime (AIR)......Page 594
16.10 Web Resources......Page 595
Part 4: Rich Internet Application Server Technologies......Page 596
17 Web Servers (IIS and Apache)......Page 597
17.2 HTTP Transactions......Page 598
17.3 Multitier Application Architecture......Page 602
17.4 Client-Side Scripting versus Server-Side Scripting......Page 603
17.6 Microsoft Internet Information Services (IIS)......Page 604
17.7 Apache HTTP Server......Page 609
17.8 Requesting Documents......Page 611
17.9 Web Resources......Page 612
18 Database: SQL, MySQL, ADO.NET 2.0 and Java DB......Page 613
18.1 Introduction......Page 614
18.2 Relational Databases......Page 615
18.3 Relational Database Overview: A books Database......Page 616
18.4 SQL......Page 619
18.6 Instructions for Installing MySQL......Page 628
18.7 Instructions for Setting Up a MySQL User Account......Page 629
18.9 ADO.NET Object Model......Page 630
18.11 Web Resources......Page 632
19 PHP......Page 634
19.1 Introduction......Page 635
19.2 PHP Basics......Page 636
19.3 String Processing and Regular Expressions......Page 646
19.4 Form Processing and Business Logic......Page 651
19.5 Connecting to a Database......Page 658
19.6 Using Cookies......Page 662
19.7 Dynamic Content......Page 668
19.8 Operator Precedence Chart......Page 677
19.9 Web Resources......Page 679
20 Ruby on Rails......Page 680
20.2 Ruby......Page 681
20.3 Rails Framework......Page 688
20.4 ActionController and ActionView......Page 690
20.5 A Database-Driven Web Application......Page 693
20.6 Case Study: Message Forum......Page 698
20.7 Script.aculo.us......Page 719
20.8 Web Resources......Page 727
21 ASP.NET 2.0 and ASP.NET Ajax......Page 728
21.1 Introduction......Page 729
21.2 Creating and Running a Simple Web Form Example......Page 730
21.3 Web Controls......Page 744
21.4 Session Tracking......Page 765
21.5 Case Study: Connecting to a Database in ASP.NET......Page 781
21.6 Case Study: Secure Books Database Application......Page 793
21.7 ASP.NET Ajax......Page 821
21.8 Web Resources......Page 825
22 JavaServer Faces Web Applications......Page 826
22.1 Introduction......Page 827
22.2 Java Web Technologies......Page 828
22.3 Creating and Running a Simple Application in Netbeans......Page 831
22.4 JSF Components......Page 848
22.5 Session Tracking......Page 861
22.6 Web Resources......Page 884
23 AJAX-Enabled JavaServer Faces Web Applications......Page 886
23.1 Introduction......Page 887
23.2 Accessing Databases in Web Applications......Page 888
23.3 Ajax-Enabled JSF Components......Page 900
23.4 AutoComplete Text Field and Virtual Forms......Page 901
23.5 Google Maps Map Viewer Component......Page 909
23.6 Web Resources......Page 918
24 Web Services......Page 919
24.1 Introduction......Page 920
24.3 Creating, Publishing, Testing and Describing a Web Service......Page 922
24.4 Consuming a Web Service......Page 933
24.5 SOAP......Page 942
24.6 Session Tracking in Web Services......Page 943
24.7 Consuming a Database-Driven Web Service from a Web Application......Page 959
24.8 Passing an Object of a User-Defined Type to a Web Service......Page 967
24.9 REST-Based Web Services in ASP.NET......Page 977
24.10 Web Resources......Page 988
A......Page 990
B......Page 992
C......Page 993
D......Page 995
E......Page 997
F......Page 1000
G......Page 1001
H......Page 1002
I......Page 1003
L......Page 1004
M......Page 1005
N......Page 1007
P......Page 1008
R......Page 1010
S......Page 1011
T......Page 1014
U......Page 1015
W......Page 1016
X......Page 1018
Z......Page 1019