in Book reviews, Struts 2

Review of the book Apache Struts 2 – Web Application Development

This book is made of 15 chapters. One might consider that the first nine chapters (205 pages) explain what’s new with Struts 2 and that the rest of the book
is a mix of JavaScript/Ajax learning and good practices to document and test a web application.

It is based on the 2.1.6 version of Struts.

The book samples can be downloaded at the following address : http://www.packtpub.com/files/code/3391_Code.zip

Chapter 1 :
This chapter 1 is a first introduction to Struts 2 with a list of the main new features.
The reader is also introduced to the Agile method.

Chapter 2 :
This chapter is still about the new features in Struts 2. The author begins the development of a RecipeBox application,
a recipe swapping website, following the Agile method with user stories.
The Configuration Browser and Convention plug-ins are used.

Chapter 3 :
This chapter is about the ActionSupport class (validation, internationalization …).
The author also provides tips for development with the use of Cygwin and Eclipse.

Chapter 4 :
This chapter focuses on Results which are the actions’ responses. Different Result types are examined, in particular FreeMarker.
The Convention plug-in is widely used in the samples (annotations @Result, @Action …).

Chapter 5 :
In this chapter, the autheur examines OGNL, the value stach and several tags (<s:include>, <s:sort>, <s:append>, <s:merge>, <s:action>, <s:generator>, <s:url>, …). These generic tags are richly explained, even those that are not frequently used.

Chapter 6 :
This chapter examines the UI tags that are part of the “form”. Each UI tag (<s:form>, <s:textfield>, <s:checkbox>, …)
is well explained, with samples. The author gives a small introduction to themes and templates (they are detailed in chapter 12).
He also gives explanations to upload files and to handle double submits (<s:token> tag).

Chapter 7 :
This chapter looks at the validation and the conversion of data. The different methods of validation are explained
(XML file, manaul validation, annotations), whether it is server-side or client-side (JavaScript).
I found the explanations sufficient and the remarks pertinent.

Chapter 8 :
This chapter is about interceptors and examines those that are available in the default stack. It explains how to write
your own interceptors with a sample (trim interceptor) that i found well documented with code and configuration explanations.

Chapter 9 :
The different mecanisms to handle exceptions and logs are examined in this chapter. The author explains the logs configuration with Log4J.

Chapter 10 :
In this chapter entirely dedicated to JavaScript, the author explains the syntax of this widely used language for the development of Web applications.

Chapter 11 :
This chapter is still about JavaScript but also CSS and the jQuery library. I liked the sample, at the end of the chapter,
to add a line, in a dynamic way, in a form and which is a frequent requirement.

Chapter 12 :
During my previous researches, I found very little information for the creation of themes. That is why I think this short chapter, dedicated to themes and templates, provides a precious help.

Chapter 13 :
This chapter describes the Dojo JavaScript library and takes a look at the Dojo tags in Struts 2 to create Ajax applications.
The REST plug-in is also introduced, with its different return types (JSON, XML, XHTML).

Chapter 14 :
This chapter is dedicated to tests and examines test-driven development. For this purpose the JUnit and TestNG frameworks are used.
Dependency injection is also explained and used in tests. The author takes this opportunity to introduce the Spring plug-in for Struts 2.
Finally, other forms of testing are introduced : functional testing with the help of Selenium, load testing with JMeter.

Chapter 15 :
This chapter diverges a bit from the main topic of the book (Struts 2) to look at ways to document a project.
It is then an opportunity for the author to introduce AOP, the Javadoc tool, UML modeling, source code contro systems …

What I liked the most :
The references that are given at the end of each chapter. They are links for the reader to check if he wants to take a deeper look into topics of the current chapter.

What I liked the least :
I do not really have any negative critic to make on the content of the book. I think it represents a real nice effort to explain the new features of Struts 2 and that it will help developers who want to learn the framework in this latest version, which has often been criticized for its lack of documentation.

You can order a copy of the book on the Packt Publishing site.

ApacheStruts2WebApplicationDev