MySQL and JSP Web Applications - Turner_ James.pdf
(
3392 KB
)
Pobierz
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
MySQL™ and JSP™ Web Applications: Data-Driven Programming Using
Tomcat and MySQL
By
James Turner
Publisher : Sams Publishing
Pub Date : March 27, 2002
ISBN : 0-672-32309-5
Pages : 400
Table of
Contents
JSP developers encounter unique problems when building web applications that require
intense database connectivity.
MySQL and JSP Web Applications
addresses the
challenges of building data-driven applications based on the JavaServer Pages
development model.
MySQL and JSP Web Applications
begins with an overview of the
core technologies required for JSP database development--JavaServer Pages, JDBC, and
the database schema. The book then outlines and presents an Internet commerce
application that demonstrates concepts such as receiving and processing user input,
designing and implementing business rules, and balancing the user load on the server.
Through the JDBC (Java DataBase Connector), the developer can communicate with
most commercial databases, such as Oracle. The solutions presented in
MySQL and JSP
Web Applications
center on the open source tools MySQL and Tomcat, allowing the
reader an affordable way to test applications and experiment with the book's examples.
Brought to you by ownSky!!
Table of Content
Table of Content
.................................................................................................................. i
Copyright
............................................................................................................................. vi
Trademarks
.................................................................................................................... vi
Warning and Disclaimer
............................................................................................... vi
Credits
............................................................................................................................. vi
Dedication
..................................................................................................................... vii
About the Authors
............................................................................................................. vii
Acknowledgments
........................................................................................................... viii
Tell Us What You Think!
................................................................................................. viii
An Introduction to Developing E-Commerce Applications with JSP
....................... viii
Who Are You and Why Are You Reading This Book?
............................................ ix
So What Is JSP All About?
.......................................................................................... ix
An Overview of JSP Platforms
................................................................................... xii
Why Do We Need Databases?
................................................................................. xiv
MySQL
........................................................................................................................... xv
Putting Tomcat and MySQL Together
..................................................................... xvi
A Roadmap to E-Commerce Development
............................................................ xvii
The Next 17 Chapters
................................................................................................ xix
Part I: JSP and JDBC
............................................................................................................. 1
Chapter 1. A JSP/JDBC Review
...................................................................................... 2
How Does JSP Work
..................................................................................................... 2
Running Tomcat
............................................................................................................. 5
Finding the Java Sources
............................................................................................. 7
A Quick Look at JDBC and MySQL
............................................................................ 9
Working with
ResultSet
s
......................................................................................... 13
Using
PreparedStatement
.................................................................................... 14
Inserting, Deleting, and Updating
.............................................................................. 15
Using Cursors
............................................................................................................... 15
Summary
....................................................................................................................... 16
Chapter 2. Java Beans and JSP
.................................................................................... 17
Bean Basics
.................................................................................................................. 17
Bean Persistence
......................................................................................................... 18
Application-Scoped Object and Singleton Classes
................................................. 25
Wrapping Up Beans
..................................................................................................... 26
Chapter 3. Using Servlet Functionality with JSP
......................................................... 27
Moving from CGI to Servlets
...................................................................................... 27
Looking at an Example Servlet
.................................................................................. 27
The End of the Beginning
........................................................................................... 35
Part II: Sample Application: Functional Requirements
................................................... 37
Chapter 4. The Sample Application Functional Requirements Document
.............. 38
Welcome to Books for Geeks
..................................................................................... 38
A High-Level View
........................................................................................................ 39
Diving into Design
........................................................................................................ 50
Summary
....................................................................................................................... 50
Chapter 5. Developing ERDs and Use Cases
............................................................. 52
The Entity Relation Diagram
...................................................................................... 52
Mining High-Level Use Cases Descriptions for Objects
........................................ 54
The
User
Class
............................................................................................................ 55
The
Product
Class
.................................................................................................... 58
The
Shopping Cart
and
Order
Classes
............................................................. 59
Use Cases
..................................................................................................................... 60
ii
Moving Ahead
............................................................................................................... 65
Summary
....................................................................................................................... 66
Chapter 6. Creating the Database Schema and Populating Data
............................ 67
The Fading Role of the DBA
...................................................................................... 67
Building a Database Schema
..................................................................................... 67
The Database from 20,000 Feet
................................................................................ 83
Summary
....................................................................................................................... 83
Part III: Sample Application: Implementation
................................................................... 85
Chapter 7. Setting Up an Application's Infrastructure
................................................. 86
Build Management
....................................................................................................... 86
Logging and Database Connection Pooling
............................................................ 89
Configuring Turbine
..................................................................................................... 90
Using Turbine Connection Pooling
............................................................................ 93
Using Log4J
.................................................................................................................. 94
Customizing Log4J
...................................................................................................... 97
Getting Ready to Code
................................................................................................ 98
Summary
....................................................................................................................... 99
Chapter 8. Retrieving, Storing, and Verifying User Input
......................................... 100
The
Customer
Class
................................................................................................ 100
Reading and Writing Customers from the Database
............................................ 101
Cleaning Up the Code
............................................................................................... 105
Accessing the
Customer
Class from JSP
............................................................. 108
Field Validation
........................................................................................................... 109
Handling Forgotten Passwords
................................................................................ 113
Using Cookies to Store Login
................................................................................... 118
Moving On
................................................................................................................... 120
Chapter 9. Publishing Data from Database Sources
................................................ 122
Looking at the Default Document Structure
........................................................... 122
The Document Structure in Practice
....................................................................... 126
The
Product
and
Category
Classes
.................................................................. 128
The
Author
Object
................................................................................................... 132
The
Category
Class
................................................................................................ 136
Cleaning Things Up
................................................................................................... 144
Summary
..................................................................................................................... 145
Chapter 10. Session Persistence and Complex Form Handling
............................. 146
Implementing the Shopping Cart
............................................................................. 146
Buying More Than One Thing at Once
................................................................... 152
Displaying and Editing the Shopping Cart
.............................................................. 154
Loose Ends
................................................................................................................. 158
The Next Step: Filling and Spilling
.......................................................................... 158
Chapter 11. Intersession Persistence
......................................................................... 159
Filling and Spilling
...................................................................................................... 159
The Address Book
..................................................................................................... 166
Credit Cards and the Wallet
..................................................................................... 181
Time to Get Down to Business
................................................................................ 195
Chapter 12. Implementing Business Logic
................................................................. 196
Today Only! Buy One, Get One Free!
.................................................................... 196
Implementing Promotions
......................................................................................... 197
Stubbing Out Taxes and Shipping
........................................................................... 202
Finalizing the Order
................................................................................................... 205
Final Confirmation
...................................................................................................... 213
The Last Mile
.............................................................................................................. 215
Chapter 13. Completing the Application
..................................................................... 216
Charging the Credit Card
.......................................................................................... 216
iii
About Credit Cards
.................................................................................................... 225
Completing the Order
................................................................................................ 227
Order History
............................................................................................................... 229
In Retrospect
............................................................................................................... 234
Next Steps for the Site
.............................................................................................. 234
Dotting the I's and Crossing the T's
........................................................................ 235
Making It Turn-Key
..................................................................................................... 242
Resetting to a Clean State
........................................................................................ 242
Summary, and on to the Advanced Stuff
................................................................ 242
Part IV: Advanced JSP Topics
.......................................................................................... 244
Chapter 14. Integrating XML into e-Commerce Web Sites
...................................... 245
The Benefits of XML
.................................................................................................. 245
The Xerces XML Package
........................................................................................ 245
A DTD for Products
.................................................................................................... 246
Writing a SAX Parser
................................................................................................. 247
Writing a DOM Parser
............................................................................................... 254
Generating XML
......................................................................................................... 260
Summary
..................................................................................................................... 266
Chapter 15. Using LDAP with JNDI
............................................................................. 267
The World of LDAP
.................................................................................................... 267
The LDAP Schema
.................................................................................................... 268
Getting LDAP'ed
......................................................................................................... 269
JNDI
............................................................................................................................. 274
Testing LDAP Reading
.............................................................................................. 279
Testing LDAP Creation
............................................................................................. 280
Trying Out LDAP Modification
.................................................................................. 284
Running a Search Against LDAP
............................................................................ 288
Creating Your Own Schemas
................................................................................... 290
Summary
..................................................................................................................... 291
Chapter 16. The Struts Application Framework
......................................................... 292
The MVC Pattern
....................................................................................................... 292
A First Look at Struts
................................................................................................. 293
Setting Up Struts
........................................................................................................ 294
The struts-config.xml File
.......................................................................................... 294
The
ActionForm
...................................................................................................... 298
The
Action
................................................................................................................ 299
The Address Editing Page
........................................................................................ 301
Two-Step Forms
......................................................................................................... 305
Configuring the Web Application Descriptor
.......................................................... 311
Summary
..................................................................................................................... 315
Ch4apter 17. Enterprise JavaBeans
........................................................................... 316
The Pros and Cons of EJB
....................................................................................... 316
EJB in 30 Seconds
..................................................................................................... 317
Stateless, Stateful, and Entity Beans
...................................................................... 317
Setting Up JBoss
........................................................................................................ 318
Creating a Stateless Session Bean
......................................................................... 319
Being Stateful
............................................................................................................. 323
Talking to MySQL with Entity Beans
....................................................................... 326
A Final Goodbye to EJB
............................................................................................ 336
Chapter 18. Security, Load Balancing, Failover, and Other Considerations
......... 337
Security, Part 1
........................................................................................................... 337
Integrating with Apache
............................................................................................. 340
Load Balancing
........................................................................................................... 342
Writing Applications for Multimachine Service
....................................................... 344
iv
Plik z chomika:
superktos86
Inne pliki z tego folderu:
MySQL and JSP Web Applications - Turner_ James.chm
(5249 KB)
MySQL and JSP Web Applications - Turner_ James.pdf
(3392 KB)
cover.jpg
(63 KB)
metadata.opf
(4 KB)
Inne foldery tego chomika:
Zgłoś jeśli
naruszono regulamin