About the Authors |
|
xv | |
About the Editor |
|
xvi | |
About the Technical Reviewers |
|
xvii | |
Acknowledgments |
|
xviii | |
Preface for This Edition |
|
xix | |
Preface from Previous Edition |
|
xx | |
|
What We Do Wrong: Web Antipatterns Explained |
|
|
1 | (30) |
|
|
3 | (1) |
|
What This Chapter Is About |
|
|
4 | (1) |
|
Challenges of Web Application Development |
|
|
4 | (4) |
|
|
6 | (1) |
|
|
7 | (1) |
|
An Introduction to Patterns and Antipatterns |
|
|
8 | (16) |
|
Web Application Antipatterns |
|
|
9 | (1) |
|
|
10 | (3) |
|
|
13 | (3) |
|
|
16 | (2) |
|
|
18 | (2) |
|
|
20 | (2) |
|
|
22 | (2) |
|
Antipatterns, JOS Frameworks, and Economics |
|
|
24 | (7) |
|
|
27 | (1) |
|
|
28 | (3) |
|
|
31 | (44) |
|
The JavaEdge Application Architecture |
|
|
32 | (20) |
|
|
33 | (1) |
|
Using Struts to Implement the MVC Pattern |
|
|
34 | (3) |
|
Getting Started: The JavaEdge Source Tree |
|
|
37 | (11) |
|
The Power of the Command Pattern |
|
|
48 | (4) |
|
Constructing the Presentation Tier |
|
|
52 | (21) |
|
|
53 | (4) |
|
|
57 | (10) |
|
|
67 | (1) |
|
|
68 | (1) |
|
|
69 | (2) |
|
|
71 | (2) |
|
|
73 | (2) |
|
Form Presentation and Validation with Struts |
|
|
75 | (48) |
|
Problems with Form Validation |
|
|
75 | (2) |
|
Using Struts for Form Validation |
|
|
77 | (2) |
|
Implementing Form Validation with Struts |
|
|
79 | (24) |
|
The struts-config.xml File |
|
|
80 | (1) |
|
|
81 | (6) |
|
Prepopulating an ActionForm with Data |
|
|
87 | (4) |
|
Another Technique for Prepopulation |
|
|
91 | (1) |
|
Prepopulating a Form the Correct Way |
|
|
92 | (1) |
|
|
93 | (10) |
|
The Struts HTML Tag Library |
|
|
103 | (19) |
|
Setting Up a Struts HTML Form |
|
|
104 | (3) |
|
Using Text and TextArea Input Fields |
|
|
107 | (1) |
|
Drop-Down Lists, Checkboxes, and Radio Buttons |
|
|
108 | (3) |
|
Building More Dynamic ActionForms |
|
|
111 | (7) |
|
ActionForms and Business Logic |
|
|
118 | (4) |
|
|
122 | (1) |
|
Managing Business Logic with Struts |
|
|
123 | (50) |
|
Business Logic Antipatterns and Struts |
|
|
124 | (10) |
|
|
125 | (5) |
|
|
130 | (2) |
|
Separating Business Logic from Struts |
|
|
132 | (2) |
|
Implementing the Design Patterns |
|
|
134 | (26) |
|
Implementing the Business Delegate Pattern |
|
|
135 | (6) |
|
Implementing the Service Locator Pattern |
|
|
141 | (8) |
|
The Service Locator Revisited |
|
|
149 | (5) |
|
|
154 | (6) |
|
Handling Exceptions in the Action Class |
|
|
160 | (11) |
|
Exception Handling in Struts 1.0x |
|
|
161 | (2) |
|
Exception Handling in Struts 1.1 and Later |
|
|
163 | (1) |
|
Rewriting the ApplicationException Class |
|
|
164 | (1) |
|
Setting Up the struts-config.xml File |
|
|
164 | (3) |
|
Writing a Custom ExceptionHandler |
|
|
167 | (4) |
|
|
171 | (2) |
|
Architecting the Data Access Tier with ObjectRelationalBridge |
|
|
173 | (52) |
|
Developing a Data Access Strategy |
|
|
174 | (34) |
|
The JavaEdge Data Access Model |
|
|
176 | (6) |
|
|
182 | (2) |
|
The JavaEdge Value Objects |
|
|
184 | (3) |
|
Using an O/R Mapping Tool |
|
|
187 | (3) |
|
Setting Up the Object/Relational Mappings |
|
|
190 | (11) |
|
Which Sequence Manager to Use? |
|
|
201 | (7) |
|
|
208 | (11) |
|
Retrieving Data: A Simple Example |
|
|
212 | (3) |
|
Retrieving Data: A More Complicated Example |
|
|
215 | (2) |
|
|
217 | (2) |
|
|
219 | (1) |
|
|
219 | (4) |
|
|
223 | (2) |
|
Building Flexible Front-Ends with the Tiles Framework |
|
|
225 | (30) |
|
What Is the Tiles Framework? |
|
|
227 | (1) |
|
Enabling Struts Version 1.1 to Use Tiles |
|
|
228 | (7) |
|
Configuring the Tiles Plug-In |
|
|
229 | (2) |
|
|
231 | (1) |
|
|
231 | (1) |
|
Your First Tiles Template |
|
|
232 | (3) |
|
What Are Tiles Definitions? |
|
|
235 | (1) |
|
Tiles Definitions: A JSP-Based Approach |
|
|
236 | (12) |
|
Overriding the Attribute Values in a Tiles Definition |
|
|
238 | (1) |
|
Using Dummy Values in Your Tiles Definition |
|
|
239 | (1) |
|
Disadvantages of JSP Tiles Definitions |
|
|
239 | (1) |
|
Anatomy of the tiles-defs.xml File |
|
|
240 | (1) |
|
Inheritance Using Tiles Definitions |
|
|
241 | (3) |
|
Extending a Tiles Definition |
|
|
244 | (1) |
|
Modifying the template.jsp File |
|
|
245 | (1) |
|
Adding the New Definition to tiles-defs.xml |
|
|
246 | (1) |
|
Modifying the .homePage Definition |
|
|
247 | (1) |
|
Mapping Tiles Definitions to Action Forwards |
|
|
248 | (4) |
|
|
252 | (3) |
|
Dynamic Forms and the Struts Validator Framework |
|
|
255 | (34) |
|
Introducing Dynamic Forms |
|
|
256 | (10) |
|
Defining the postStoryForm Struts Form Bean |
|
|
256 | (2) |
|
Writing the PostStoryDynaForm.java Implementation |
|
|
258 | (5) |
|
Some Thoughts About BeanUtils and the Preceding Code |
|
|
263 | (3) |
|
The Jakarta Commons Validator Framework |
|
|
266 | (7) |
|
Validator Framework Setup |
|
|
266 | (2) |
|
Implementing the Required Fields Validation |
|
|
268 | (2) |
|
The maxlength Validation Rule |
|
|
270 | (3) |
|
Use the Validator Framework Within an ActionForm Class |
|
|
273 | (12) |
|
Writing Your Own Validation Rules |
|
|
275 | (1) |
|
Implementing the Vulgarity Rule |
|
|
275 | (4) |
|
Adding the Vulgarity Rule to the validator-rules.xml File |
|
|
279 | (2) |
|
Struts Validation and Potential Long-Term Consequences |
|
|
281 | (1) |
|
Implementing the Vulgarity Rule in a Form |
|
|
282 | (1) |
|
An ActionForm Without Java |
|
|
283 | (1) |
|
When to Use the Validator Framework |
|
|
284 | (1) |
|
|
285 | (4) |
|
Speeding Struts Development with XDoclet |
|
|
289 | (28) |
|
|
291 | (1) |
|
|
292 | (7) |
|
From XDoclet to Source, and All the Steps in Between |
|
|
295 | (2) |
|
The Available XDoclet Tags |
|
|
297 | (1) |
|
Anatomy of an XDoclet Tag |
|
|
298 | (1) |
|
Integrating Ant and XDoclet |
|
|
299 | (4) |
|
|
302 | (1) |
|
|
303 | (12) |
|
Declaring Struts Form Beans |
|
|
304 | (1) |
|
|
304 | (2) |
|
XDoclet and Java Inheritance |
|
|
306 | (1) |
|
Declaring Application Exceptions |
|
|
306 | (2) |
|
Building struts-config.xml Using <webdoclet ..../> |
|
|
308 | (1) |
|
XDoclets and the Validator Framework |
|
|
309 | (4) |
|
Generating the Validator Tags from Ant |
|
|
313 | (2) |
|
|
315 | (2) |
|
|
317 | (42) |
|
|
318 | (1) |
|
|
319 | (1) |
|
Simple Web Application Logging |
|
|
319 | (6) |
|
Logging with ServletContext |
|
|
319 | (1) |
|
|
320 | (5) |
|
|
325 | (31) |
|
|
328 | (2) |
|
Using log4j with Commons Logging |
|
|
330 | (4) |
|
|
334 | (3) |
|
|
337 | (1) |
|
|
338 | (4) |
|
|
342 | (1) |
|
Integrating Logging into JavaEdge |
|
|
343 | (6) |
|
|
349 | (2) |
|
Debugging Struts Applications Using JBoss and Eclipse |
|
|
351 | (2) |
|
Debugging the JavaEdge Application |
|
|
353 | (2) |
|
|
355 | (1) |
|
Debugging the Struts Framework |
|
|
356 | (1) |
|
|
356 | (3) |
|
|
359 | (32) |
|
What Is a Template Engine? |
|
|
359 | (1) |
|
|
360 | (28) |
|
Velocity and VelocityContext Classes |
|
|
362 | (1) |
|
Velocity Template Language |
|
|
362 | (1) |
|
|
363 | (1) |
|
|
363 | (1) |
|
|
364 | (5) |
|
|
369 | (1) |
|
|
369 | (1) |
|
|
370 | (9) |
|
|
379 | (2) |
|
|
381 | (1) |
|
|
381 | (7) |
|
|
388 | (1) |
|
Best Practices for Velocity Use |
|
|
388 | (1) |
|
|
388 | (1) |
|
Know When to Use #parse and When to Use #include |
|
|
388 | (1) |
|
Use JavaBean Property Names |
|
|
389 | (1) |
|
|
389 | (2) |
|
Extending the Struts Framework |
|
|
391 | (30) |
|
Extending Action and ActionForm |
|
|
391 | (7) |
|
Providing Common Services to Your Actions |
|
|
392 | (5) |
|
Hooking into the Action Execution |
|
|
397 | (1) |
|
Extending RequestProcessor |
|
|
398 | (5) |
|
Building a RequestProcessor |
|
|
399 | (1) |
|
Using RequestProcessor Instead of Filter |
|
|
400 | (3) |
|
Verifying Host Access with RequestProcessor |
|
|
403 | (1) |
|
Creating Configuration Beans |
|
|
403 | (2) |
|
Building the JavaEdgeActionMapping |
|
|
404 | (1) |
|
Revisiting RequestProcessor |
|
|
405 | (4) |
|
|
409 | (10) |
|
Newsletter Service Basics |
|
|
410 | (1) |
|
|
410 | (5) |
|
|
415 | (1) |
|
|
416 | (3) |
|
|
419 | (1) |
|
|
419 | (2) |
|
|
421 | (12) |
|
|
421 | (1) |
|
|
422 | (1) |
|
|
422 | (1) |
|
|
422 | (1) |
|
|
423 | (1) |
|
|
423 | (1) |
|
|
423 | (3) |
|
Ajax Request-Response Cycle |
|
|
424 | (1) |
|
|
425 | (1) |
|
Ajax and Struts in Action |
|
|
426 | (6) |
|
|
426 | (3) |
|
|
429 | (1) |
|
|
430 | (2) |
|
|
432 | (1) |
|
APPENDIX A JavaEdge Setup and Installation |
|
|
433 | (8) |
|
|
433 | (7) |
|
|
433 | (3) |
|
|
436 | (1) |
|
|
436 | (1) |
|
Obtaining the JavaEdge Code and Dependencies |
|
|
437 | (1) |
|
Installing the JavaEdge Database |
|
|
437 | (1) |
|
|
438 | (1) |
|
|
439 | (1) |
|
|
440 | (1) |
|
APPENDIX B Struts Development Tools |
|
|
441 | (32) |
|
|
442 | (2) |
|
|
444 | (1) |
|
|
444 | (1) |
|
|
444 | (3) |
|
JSP, HTML, XML, and DTD Editors |
|
|
444 | (2) |
|
|
446 | (1) |
|
|
446 | (1) |
|
|
447 | (1) |
|
|
447 | (5) |
|
Creating a Struts Project |
|
|
447 | (1) |
|
|
448 | (1) |
|
Creating Actions and ActionForms |
|
|
449 | (2) |
|
|
451 | (1) |
|
|
451 | (1) |
|
|
452 | (1) |
|
|
452 | (5) |
|
|
452 | (1) |
|
Configuration File Editor |
|
|
453 | (1) |
|
|
454 | (1) |
|
|
454 | (1) |
|
|
454 | (2) |
|
|
456 | (1) |
|
|
456 | (1) |
|
|
457 | (1) |
|
|
457 | (4) |
|
|
457 | (1) |
|
Editing the Struts Configuration File |
|
|
458 | (2) |
|
Editing Other Configuration Files |
|
|
460 | (1) |
|
|
460 | (1) |
|
|
461 | (1) |
|
|
461 | (5) |
|
|
461 | (1) |
|
Configuration File Editors |
|
|
461 | (2) |
|
|
463 | (1) |
|
|
463 | (2) |
|
|
465 | (1) |
|
|
465 | (1) |
|
|
466 | (1) |
|
|
466 | (1) |
|
|
466 | (5) |
|
|
466 | (1) |
|
|
466 | (1) |
|
|
467 | (3) |
|
|
470 | (1) |
|
|
471 | (1) |
|
|
471 | (2) |
|
APPENDIX C Struts and Strecks |
|
|
473 | (4) |
|
|
473 | (3) |
|
@Controller and @ActionInterface |
|
|
474 | (1) |
|
|
475 | (1) |
|
@BindSimple and @ValidateRequired |
|
|
475 | (1) |
|
What You Can Do with Strecks |
|
|
476 | (1) |
|
|
476 | (1) |
Index |
|
477 | |