I really liked this book. I am already a user of Spring, Hibernate, JUnit and Velocity. For this reason I found the integration of Struts2 with these very useful. I can see where others not versed in these may find it a little difficult, but the sample uses of these technologies are pretty simple and straightforward. Therefore, new users of these technologies may have to spend some extra time in Chapter 4 to familiarize themselves with these technologies and how Struts2 works with them.
I started using Maven2 with this book and it was a very useful jumpstart into Maven2. I also use Eclipse and MyEclipse and was able to use Maven2 to create eclipse projects (mvn eclipse:eclipse) for each chapter and follow along by stepping through and changing the code in MyEclipse by running the war file (mvn package) in the built-in Tomcat web server.
Also, I am not an experienced user of Struts 1. I have working knowledge of Struts 1 having been involved in a project where I had to make some enhancements. But I didn't have a problem learning Struts2 with very little knowledge of Struts 1 using this book.
My only problem has been getting the Persistence rollback to work in the JUnit tests. Still trying to figure that out, but I have been able to work around this.
Some of the concepts and details used in the example code aren't fully discussed in the book. However, I have been able to study those by looking at the sample code.
I would recommend this book to those that are already familiar with the Spring framework, Hibernate, JSPs and J2EE. It's an excellent jumpstart into Struts2 if you're familiar using those technologies.
Author(s): Ian Roughley
Series: Practical Projects
Edition: 1
Publisher: Apress
Year: 2007
Language: English
Pages: 360
Practical Apache Struts2 Web 2.0 Projects......Page 1
Contents at a Glance......Page 7
Contents......Page 9
Foreword......Page 15
About the Author......Page 17
About the Technical Reviewer......Page 18
Acknowledgments......Page 19
Introduction......Page 21
What Is Web 2.0?......Page 23
Web Framework Agility with Struts2......Page 28
Using this Book......Page 30
The Build Process......Page 33
Maven2......Page 34
Installing and Using Maven2......Page 35
The Maven2 Life Cycle Phases......Page 36
The Maven2-Generated Directory and File Structure......Page 37
The Maven2 Configuration File......Page 38
Starter Application Features......Page 42
Getting to the First Screen......Page 44
Submitting the Form......Page 48
Validating the Form Field......Page 50
Converting Data Types......Page 54
Testing the Actions......Page 56
Summary......Page 57
Walking Through a Request-Response......Page 59
The Struts2 Servlet Filter......Page 60
Interceptors......Page 61
Exploring the Core Components......Page 62
Actions......Page 63
Interceptors......Page 64
Custom Interceptors......Page 67
The Value Stack and OGNL......Page 68
Results and Result Types......Page 70
Tag Libraries......Page 71
Themes......Page 73
Zero Configuration Annotations......Page 74
File......Page 77
Include Files......Page 78
Packages......Page 79
Interceptors......Page 80
Global Results......Page 82
Global Exception Handling......Page 83
Actions......Page 85
Configuring the Execution Environment......Page 87
Extending the Framework......Page 89
Summary......Page 91
The Application......Page 93
Use Cases......Page 94
Integration Technologies......Page 95
The Domain Model......Page 96
An Agile Development Process......Page 97
Continuous Integration......Page 98
Integrating the Persistence Layer......Page 99
Configuring the Dependencies......Page 100
Installing MySQL......Page 103
Configuring Hibernate......Page 105
Using Hibernate to Create Data Access Objects......Page 107
Summary......Page 110
The Use Case......Page 111
The Domain Model......Page 112
Model-Driven Actions......Page 113
Setup Code and Data Prepopulation......Page 114
Configuration......Page 118
Single Unit of Work......Page 120
Zero Configuration......Page 122
Plug-In......Page 126
Finishing Up......Page 128
Multiple Units of Work......Page 130
Wildcard Configuration Mappings......Page 132
Unit Testing......Page 134
JSP Templates......Page 138
Internationalization......Page 145
Internationalized Text Resources......Page 146
Text Elements......Page 148
Input Validation......Page 149
Exception Handling......Page 155
Unexpected Errors......Page 156
Recovery via User Interaction......Page 157
Zero Configuration Actions......Page 158
Displaying the Error......Page 159
File Uploads......Page 162
Action Modifications......Page 165
XML-Configured Actions and Wildcard-Configured Actions......Page 166
Zero Configuration Actions......Page 167
Summary......Page 168
The Use Case......Page 169
The Scope Interceptor......Page 172
Configuration......Page 173
Workflow Elements......Page 175
Custom Validations......Page 177
Customizing the Rendering of Struts2 Tags......Page 182
Working with Subclassed Domain Objects......Page 184
Scope......Page 190
Action Validation Using OGNL......Page 192
An Alternative Approach to Entering Contestants......Page 193
Summary......Page 200
The Use Cases......Page 201
Configuring the Container......Page 202
Configuring the Web Application......Page 204
Accessing Role Information......Page 207
Implementing Acegi......Page 209
Configuring Acegi......Page 210
The Acegi Application Context Configuration File......Page 211
Implementing a Custom Authentication Provider......Page 213
Authenticating the User......Page 215
Accessing Role Information......Page 217
Preventing Unauthorized Access......Page 222
Configuring Authorization......Page 225
Implementing Authentication......Page 227
Accessing Role Information......Page 229
Summary......Page 230
The Use Cases......Page 231
Updating the Screen Layout......Page 232
Creating a Friendly Home Page......Page 236
Modularizing the List Rendering......Page 239
Search for Events by Name......Page 242
Developing a Search Form......Page 249
Consolidating List Actions......Page 254
Summary......Page 258
The Use Case......Page 259
Implementing RSS......Page 260
Configuring Result Types......Page 263
Implementing the RSS Result Type......Page 265
Implementing an Atom Feed......Page 270
Consuming the RSS Feed with a Mashup......Page 271
Geo-Coding the Address and Creating the Feed Entry......Page 273
Implementing the Mashup Client......Page 278
Integrating a Map into the Home Page......Page 282
Implementing Web Services......Page 284
Mapping URLs to Actions......Page 285
Configuring Action Mappers......Page 287
Creating a Custom Action Mapper......Page 288
Implementing the RESTful Web Service Logic......Page 293
Summary......Page 299
AJAX......Page 301
Developing the Supporting Infrastructure......Page 302
Updating the Menu Options......Page 303
Implementing the Voting Use Cases......Page 305
Configuring the Application......Page 313
Retrieving Action Results......Page 314
Invoking Actions as Events......Page 316
AJAX Form Submission......Page 321
Using the XML Result Type......Page 324
Using the JSON Result Type Plug-in......Page 332
Using the Google Web Toolkit......Page 337
Generating the GWT Starter Code......Page 338
Configuring the Struts2 Plug-in......Page 340
Integrating Struts2 and GWT......Page 341
Summary......Page 348
Index......Page 349