Struts 2 in Action
Donald Brown, Chad Michael Davis, and Scott Stanlick
  • May 2008
  • ISBN 9781933988078
  • 424 pages
  • printed in black & white

... provides the pieces missing from the official documentation! A "must-have".

Wes Wannemacher, WanTii, Inc., Struts Committer

Struts 2 In Action introduces the Apache Struts 2 web application framework and shows you how to quickly develop professional, production-ready modern web applications. Written by Don Brown, one of the leading developers of Struts 2, Chad Davis, a passionate Struts 2 developer, along with Scott Stanlick, this book gently walks you through the key features of Struts 2 in example-driven, easy-to-digest sections.

Table of Contents show full

preface

acknowledgments

about this book

about the title

about the cover illustration

Part 1 Struts 2: a brand new framework

1. Struts 2: the modern web application framework

1.1. Web applications: a quick study

1.2. Frameworks for web applications

1.3. The Struts 2 framework

1.4. Summary

2. Saying hello to Struts 2

2.1. Declarative architecture

2.2. A quick hello

2.3. HelloWorld using annotations

2.4. Summary

Part 2 Core concepts: actions, interceptors, and type conversion

3. Working with Struts 2 actions

3.1. Introducing Struts 2 actions

3.2. Packaging your actions

3.3. Implementing actions

3.4. Transferring data onto objects

3.5. File uploading: a case study

3.6. Summary

4. Adding workflow with interceptors

4.1. Why intercept requests?

4.2. Interceptors in action

4.3. Surveying the built-in Struts 2 interceptors

4.4. Declaring interceptors

4.5. Building your own interceptor

4.6. Summary

5. Data transfer: OGNL and type conversion

5.1. Data transfer and type conversion: common tasks of the web application domain

5.2. OGNL and Struts 2

5.3. Built-in type converters

5.4. Customizing type conversion

5.5. Summary

Part 3 Building the view: tags and results

6. Building a view: tags

6.1. Getting started

6.2. An overview of Struts tags

6.3. Data tags

6.4. Control tags

6.5. Miscellaneous tags

6.6. Using JSTL and other native tags

6.7. A brief primer for the OGNL expression language

6.8. Summary

7. UI component tags

7.1. Why we need UI component tags

7.2. Tags, templates, and themes

7.3. UI Component tag reference

7.4. Summary

8. Results in detail

8.1. Life after the action

8.2. Commonly used result types

8.3. JSP alternatives

8.4. Global results

8.5. Summary

Part 4 Improving your application

9. Integrating with Spring and Hibernate/JPA

9.1. Why use Spring with Struts 2?

9.2. Adding Spring to Struts 2

9.3. Why use the Java Persistence API with Struts 2?

9.4. Summary

10. Exploring the validation framework

10.1. Getting familiar with the validation framework

10.2. Wiring your actions for validation

10.3. Writing a custom validator

10.4. Validation framework advanced topics

10.5. Summary

11. Understanding internationalization

11.1. The Struts 2 framework and Java i18n

11.2. A Struts 2 i18n demo

11.3. Struts 2 i18n: the details

11.4. Overriding the framework�s default locale determination

11.5. Summary

Part 5 Advanced topics and best practices

12. Extending Struts 2 with plug-ins

12.1. Plug-in overview

12.2. Common plug-ins

12.3. Internal component system

12.4. Writing a breadcrumb plug-in

12.5. Summary

13. Best practices

13.1. Setting up your environment 327

13.2. Unit-testing your actions

13.3. Maximizing reuse

13.4. Advanced UI tag usage

13.5. Summary

14. Migration from Struts Classic

14.1. Translating Struts Classic knowledge

14.2. Converting by piecemeal

14.3. Summary

15. Advanced topics

15.1. Advanced action usage

15.2. Dynamic method invocation

15.3. Using tokens to prevent duplicate form submits

15.4. Displaying wait pages automatically

15.5. A single action for CRUD operations

15.6. Tiles and Struts 2

15.7. Summary

index

© 2014 Manning Publications Co.

About the Technology

The original Struts project revolutionized Java web development and its rapid adoption resulted in the thousands of Struts-based applications deployed worldwide. Keeping pace with new ideas and trends, Apache Struts 2 has emerged as the product of a merger between the Apache Struts and OpenSymphony WebWork projects, united in their goal to develop an easy-to-use yet feature-rich framework. Struts 2 represents a revolution in design and ease of use when compared to classic Struts. It adds exciting and powerful features such as a plugin framework, JavaServer Faces integration, and XML-free configuration.

About the book

Struts 2 in Action delivers accurate, seasoned information that can immediately be put to work. This book is designed for working Java web developers—especially those with some background in Struts 1 or WebWork. The core content, covering key framework components such as Actions, Results, and Interceptors, includes new features like the annotation-based configuration options. You'll find chapters on Struts 2 plugins, FreeMarker, and migration from Struts 1 and WebWork 2. Finally, new topics such as the Ajax tags, Spring Framework integration, and configuration by convention give familiar subjects new depth.

What's inside

  • Handling data and displaying content with an expression language and tag libraries
  • Ajax and Struts 2
  • Workflow and Struts 2 actions
  • Type conversion and data validation
  • Internationalization and component-oriented design
  • Struts 1 and WebWork migration
  • Struts 2 plugins
  • Struts 2 best practices and architectures

About the reader

This book is designed for working Java web developers—especially those with some background in Struts 1 or WebWork.

About the authors

Don Brown is the Technical Lead for Hosted Services at Atlassian Software Systems, with a background in the commercial and US Department of Defense sectors. He is a member of the Apache Software Foundation, and has been a Struts committer since 2003. He is also a committer on several Apache Commons projects and a frequent speaker at JavaOne, ApacheCon, and Java user groups.

Chad Davis is a J2EE developer, software consultant, and writer. He has a wide background in writing that ranges from government research and public relations to academic writing in computer science. In addition to publications in a variety of computer science journals, he has published poetry and written draft legislation at the state level.

Scott Stanlick is a corporate IT instructor with experience in embedded systems, client-server applications, and large scale distributed applications. As a musician needing a "real job" to buy musical gear, he earned a B.A. in Computer Science and has been writing software to pay for his drumming habit ever since. He builds web sites during his free time and plays shows most weekends.


combo $44.99 pBook + eBook
eBook $35.99 pdf + ePub + kindle

FREE domestic shipping on three or more pBooks

Hot stuff... served cool and appetizing.

Patrick Steger, Zühlke Engineering AG

If you are working with Struts 2, then this is "the" book for you.

Patrick Dennis, Management Dynamics Inc.

... especially valuable for those eager to upgrade from Struts Classic.

Jason Kolter, Northrop Grumman Mission Systems

Lucid and entertaining.

Joe Hoover, Carol.com