CONTENTS
5
7.9 Choice components . . . . . . . . . . . . . . . . . . . . . . . . . .
89
7.10 Textfields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
7.11 Textareas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
90
7.12 Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
7.13 Tags and Naming . . . . . . . . . . . . . . . . . . . . . . . . . . .
91
7.14 Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
92
7.15 Reading and Writing on Components . . . . . . . . . . . . . . . .
92
7.16 Other Common Actions . . . . . . . . . . . . . . . . . . . . . . .
93
7.17 Reactive Programs . . . . . . . . . . . . . . . . . . . . . . . . . .
93
7.18 Calculator Programs . . . . . . . . . . . . . . . . . . . . . . . . .
94
7.19 A Chat Applet . . . . . . . . . . . . . . . . . . . . . . . . . . . .
96
7.20 Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
98
7.21 Security . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
7.22 Summary of GUI building procedures . . . . . . . . . . . . . . . 101
IV
Advanced Topics
103
8 Databases
105
8.1 Database concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 105
8.2 Intro to SQL, SQL clients, and SQL servers . . . . . . . . . . . . 105
8.3 A Simple Database backed Survey . . . . . . . . . . . . . . . . . 106
8.3.1
Overview of the survey servlet . . . . . . . . . . . . . . . 106
8.3.2
Creating a new database . . . . . . . . . . . . . . . . . . . 107
8.3.3
Creating a new table in the database . . . . . . . . . . . . 107
8.3.4
Starting a server for the database . . . . . . . . . . . . . . 108
8.3.5
The survey servlet . . . . . . . . . . . . . . . . . . . . . . 108
8.4 A Quick Intro to SQL . . . . . . . . . . . . . . . . . . . . . . . . 111
8.4.1
Creating and removing tables . . . . . . . . . . . . . . . . 111
8.4.2
Adding,Modifying, and Removing rows of tables . . . . . 112
8.4.3
Selecting rows of a table . . . . . . . . . . . . . . . . . . . 112
9 Examples of Database Servlets
113
9.0.4
A webpage incorporating database content . . . . . . . . 113
9.0.5
Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . 116
9.0.6
Deleting rows . . . . . . . . . . . . . . . . . . . . . . . . . 116
9.0.7
Adding Password Protection . . . . . . . . . . . . . . . . 116
9.1 The database backed webpage . . . . . . . . . . . . . . . . . . . . 117
9.2 A Network Database Front end . . . . . . . . . . . . . . . . . . . 119
10 Peer to Peer programming
121
10.1 Group servers and Group clients . . . . . . . . . . . . . . . . . . 121
10.2 Starting a group server . . . . . . . . . . . . . . . . . . . . . . . . 121
10.3 A Simple Chatroom applet . . . . . . . . . . . . . . . . . . . . . 122
10.4 A Multiroom Chat applet . . . . . . . . . . . . . . . . . . . . . . 124