Beginning Apache Struts (eBook)

From Novice to Professional

(Autor)

eBook Download: PDF
2006 | 1st ed.
536 Seiten
Apress (Verlag)
978-1-4302-0129-8 (ISBN)

Lese- und Medienproben

Beginning Apache Struts - Arnold Doray
Systemvoraussetzungen
39,58 inkl. MwSt
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

The only current developer-driven book positioned and based on Apache Struts 1.2 (which is still the most widely used and most popular MVC-based web application development framework)

Condensed tutorial and lab format, where material has been tested in actual class settings

Includes some preview coverage of the next generation of Struts (2.x), otherwise known as Apache Shale



Arnold Doray is Thinksquared's lead software architect and has been developing software professionally for over a decade. He has conducted several developer training courses in the U.K. and Singapore. Arnold holds a bachelor's degree in physics and a master's degree in knowledge engineering.
Beginning Apache Struts will provide you a working knowledge of Apache Struts 1.2. This book is ideal for you Java programmers who have some JSP familiarity, but little or no prior experience with Servlet technology.Organized in a condensed tutorial and lab format, the material in this book has been tested in real classroom environments. It takes a step-by-step, hands-on approach to teaching you Struts. The book even previews the next generation of Struts, the Apache Shale. The overall result is that you can quickly apply Struts to your work settings with confidence.

Arnold Doray is Thinksquared's lead software architect and has been developing software professionally for over a decade. He has conducted several developer training courses in the U.K. and Singapore. Arnold holds a bachelor's degree in physics and a master's degree in knowledge engineering.

Contents at a Glance 6
Contents 8
About the Author 20
About the Technical Reviewer 21
Acknowledgments 22
PART 1 Basic Struts 23
CHAPTER 1 Introduction 25
What Is a Web Application? 25
What Struts Can Do for You 26
About You 27
How to Read This Book 27
Useful Links 28
CHAPTER 2 Servlet and JSP Review 29
Lab 2: Installing Tomcat 29
Servlet Container Basics 32
Important Servlet Classes 34
JavaServer Pages (JSP) 35
Useful Links 38
Summary 38
CHAPTER 3 Understanding Scopes 39
Lab 3: Scopes Quiz 40
Session and Request Scope Internals 42
Summary 43
CHAPTER 4 Custom Tags 45
Custom Tag Basics 45
How Custom Tags Are Processed 46
The Java Handler Classes 48
Helper Classes 50
The TLD File 51
Lab 4: A Temperature Conversion Tag 53
Professional Java Tools 57
Useful Links 57
Summary 57
CHAPTER 5 The MVC Design Pattern 59
The Registration Webapp 61
Lab 5: MVC Quiz 67
Which Comes First? 68
Struts and MVC 69
Lifecycle of a Struts Request 70
Frameworks for the Model 71
Useful Links 72
Summary 73
CHAPTER 6 Simple Validation 75
Processing Simple Validations 75
Anatomy of ActionForm 76
Using ActionErrors 79
Lab 6: ContactForm for LILLDEP 83
What Has Struts Done for You Today? 86
Summary 87
CHAPTER 7 Processing Business Logic 89
1,2,3 Action! 89
The Statelessness of Action 90
Subclassing Action 91
Business Logic in the Registration Webapp 92
Complex Validation 95
Data Transformation 96
Navigation 97
Lab 7: Implementing ContactAction for LILLDEP 98
Summary 99
CHAPTER 8 Basic Struts Tags 101
Page Processing Lifecycle 102
The View Component of the Registration Webapp 104
Synopsis of HTML and Bean Tag Libraries 110
Lab 8: Contact Entry Page for LILLDEP 112
Useful Links 113
Summary 113
CHAPTER 9 Configuring Struts 115
The Structure of struts-config.xml 115
Configuring the Registration Webapp 116
Declaring Form Beans 117
Declaring Global Exceptions 118
Declaring Global Forwards 119
Declaring Form Handlers 120
Controller Declaration 122
Message Resources 123
Declaring Plug-ins 123
Lab 9a: Configuring LILLDEP 124
Code Reuse 125
Lab 9b: The MNC Page 126
Summary 127
CHAPTER 10 More Tags 129
Best Practices 130
The 2 + 1 Remaining Struts Libraries 130
The Logic Tag Library 131
The Nested Tag Library 137
JSTL and Struts 140
Struts EL Extensions 146
Lab 10a: The LILLDEP Full Listing Page 147
Lab 10b: Simplifying ContactForm 148
Lab 10c: Using JSTL 149
Useful Links 149
Summary 150
CHAPTER 11 Uploading Files 151
Uploading a Fixed Number of Files at Once 153
Uploading Any Number of Files 155
Lab 11: Importing Data into LILLDEP 162
Useful Links 164
Summary 164
CHAPTER 12 Internationalization 165
Character Encodings, Unicode, and UTF-8 165
Locales 168
Processing Input 168
Localizing Validations 169
Localizing Output 172
Lab 12: LILLDEP for the Malaysian Market 176
Useful Links 177
Summary 177
CHAPTER 13 Review Lab: Editing Contacts in LILLDEP 179
Implementing the Edit Facility 180
PART 2 Advanced Struts 181
CHAPTER 14 Tiles 183
Installing Tiles 184
Tiles for Layout 185
Tiles Components 191
Example: The “Login” Tiles 195
Getting External Form Data 209
Lab 14: The Find Facility 209
Summary 215
CHAPTER 15 The Validator Framework 217
Declaring the Validator Plug-in 218
Validator DTD Basics 219
Using the Validator Framework 220
The Standard Validators 227
Adding Custom Validations 231
Migrating Legacy Code 238
Localizing Validations 239
Lab 15: Using the Validator Framework in LILLDEP 240
Useful Links 240
Summary 241
CHAPTER 16 Dynamic Forms 243
Declaring Dynamic Forms 243
Accessing Dynamic Properties 247
Dynamic Form Disadvantages 248
Validating Dynamic Forms 249
The Registration Webapp with Dynamic Forms 250
See Ma, No Hands!: LazyValidatorForm (Struts 1.2.6+) 254
The Hidden Power of BeanValidatorForm (Struts 1.2.6+) 257
Lab 16: Deleting Selected Contacts in LILLDEP 258
Useful Links 259
Summary 260
CHAPTER 17 Potpourri 261
PropertyUtils 262
DownloadAction (Struts 1.2.6+) 265
LocaleAction 267
IncludeAction and ForwardAction 269
LookupDispatchAction 271
DispatchAction 276
MappingDispatchAction 277
Using Global Forwards 280
Logging 280
Using Wildcards 283
Splitting up struts-config.xml 285
Useful Links 288
Summary 288
CHAPTER 18 Review Lab: The Collection Facility 289
Lab 18a: The Main Collect Page 290
Lab 18b: The New Collection Page 291
Lab 18c: The Collection Listing Page 293
Lab 18d: Removing Selected Contacts 294
Lab 18e: Adding Selected Contacts 295
Lab 18f: Up and Down a Search 297
Summary 298
CHAPTER 19 Developing Plug-ins 299
The Task at Hand 299
Implementation Road Map 302
How Struts Processes Form Beans 303
Anatomy of a Plug-in 306
Implementing DynaFormsPlugIn 307
Reading XML with Apache’s Digester 310
Implementing DynaFormsLoaderFactory 313
DefaultDynaFormsLoader 316
Lab 19: Test Driving the DynaForms Plug-in 324
Extra Credit Lab: Handling < set-property>
Useful Links 327
Summary 328
CHAPTER 20 JavaServer Faces and Struts Shale 329
JSF Overview 329
Shale Overview 330
Learning Struts a Waste of Time? 332
JavaServer Faces (JSF) 332
Example: The Registration Webapp 344
Where to Next? 358
Lab 20: The Struts-Faces Integration Library 359
Struts Shale Preview 365
JSF vs. Shale vs. Struts 377
Useful Links 379
Summary 380
APPENDIX A Frameworks for the Model 381
Getting the Software 382
Lisptorq 382
Lab A: Test Driving Lisptorq 385
Using Torque for the Registration Webapp 388
Using Hibernate for the Registration Webapp 389
Autogenerating LILLDEP Model Classes 392
Useful Links 395
APPENDIX B Commonly Used Classes 397
javax.servlet.http.HttpServletRequest 397
javax.servlet.http.HttpSession 398
org.apache.struts.action.ActionMessage 398
org.apache.struts.action.ActionMessages 399
org.apache.struts.action.ActionMapping 399
org.apache.struts.action.Action 399
org.apache.struts.action.ActionForm 400
org.apache.struts.upload.FormFile 401
org.apache.struts.tiles.ComponentContext 402
org.apache.struts.action.ExceptionHandler 402
APPENDIX C Struts Tag Reference 403
The HTML Tag Library 403
The Bean Tag Library 443
The Logic Tag Library 458
The Nested Tag Library 473
The Tiles Tag Library 479
APPENDIX D Answers 491
Chapter 1: Introduction 491
Chapter 3: Understanding Scopes 492
Chapter 5: The MVC Design Pattern 493
Chapter 6: Simple Validation 493
Lab 8: Contact Entry Page for LILLDEP 494
Lab 9a: Configuring LILLDEP 495
Lab 9b: The MNC Page 495
Chapter 10: More Tags 496
Lab 10a: The LILLDEP Full Listing Page 497
Lab 10b: Simplifying ContactForm 497
Lab 11: Importing Data into LILLDEP 497
Chapter 13: Review Lab 498
Chapter 14: Tiles 498
Chapter 15: The Validator Framework 499
Chapter 17: Potpourri 499
Chapter 20: JavaServer Faces and Struts Shale 499
Index 501

Erscheint lt. Verlag 22.11.2006
Zusatzinfo 536 p.
Verlagsort Berkeley
Sprache englisch
Themenwelt Mathematik / Informatik Informatik Datenbanken
Informatik Web / Internet Web Design / Usability
Schlagworte Apache • code reuse • Design • Design Pattern • Development • Framework • Java • JavaServer Faces • JSP • Validation
ISBN-10 1-4302-0129-0 / 1430201290
ISBN-13 978-1-4302-0129-8 / 9781430201298
Haben Sie eine Frage zum Produkt?
PDFPDF (Wasserzeichen)
Größe: 4,0 MB

DRM: Digitales Wasserzeichen
Dieses eBook enthält ein digitales Wasser­zeichen und ist damit für Sie persona­lisiert. Bei einer missbräuch­lichen Weiter­gabe des eBooks an Dritte ist eine Rück­ver­folgung an die Quelle möglich.

Dateiformat: PDF (Portable Document Format)
Mit einem festen Seiten­layout eignet sich die PDF besonders für Fach­bücher mit Spalten, Tabellen und Abbild­ungen. Eine PDF kann auf fast allen Geräten ange­zeigt werden, ist aber für kleine Displays (Smart­phone, eReader) nur einge­schränkt geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür einen PDF-Viewer - z.B. den Adobe Reader oder Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür einen PDF-Viewer - z.B. die kostenlose Adobe Digital Editions-App.

Zusätzliches Feature: Online Lesen
Dieses eBook können Sie zusätzlich zum Download auch online im Webbrowser lesen.

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Alles, was Sie über Gestaltung im Web wissen sollten

von Björn Rohles; Jürgen Wolf

eBook Download (2023)
Rheinwerk Design (Verlag)
20,93
was alle wissen sollten, die Websites und Apps entwickeln

von Jens Jacobsen; Lorena Meyer

eBook Download (2024)
Rheinwerk Computing (Verlag)
27,93
das Handbuch zur Webgestaltung

von Martin Hahn

eBook Download (2024)
Rheinwerk Design (Verlag)
34,93