Apache Struts 2 Web Application Development (Paperback)

Dave Newton



A beginner's guide for Java developers
  • Design, develop, test, and deploy your web applications using Struts 2 framework
  • No prior knowledge of JavaScript and CSS is required
  • Apply the best of agile development techniques and TDD techniques
  • Step-by-step instructions and careful explanations with lots of code examples

In Detail

Struts 2.1 is a modern, extensible, agile web application framework suitable for both small- and large-scale web applications.

The book begins with a comprehensive look at Struts 2.1 basics, interspersed with detours into more advanced development topics. You'll learn about configuring Struts 2.1 actions, results, and interceptors via both XML and Java annotations. You'll get an introduction to most of the Struts 2.1 custom tags and learn how they can assist in rapid application prototyping and development.

From there you'll make your way into Struts 2.1's strong support for form validation and type conversion, which allows you to treat your form values as domain objects without cluttering your code. A look at Struts 2.1's interceptors is the final piece of the Struts 2.1 puzzle, allowing you to leverage the standard Struts 2 interceptors as well as implement your own custom behavior.

After covering Struts 2.1 you'll journey into the world of JavaScript, a surprisingly capable language, the Document Object Model (DOM), and CSS, and learn how to create clean and concise client-side behavior. You'll leverage that knowledge as you move on to Struts 2 themes and templates, which give you a powerful way to encapsulate site-wide user interface behavior.

The book closes with a look at some tools that make the application development life cycle easier to manage, particularly in a team environment, and more automatic.

What you will learn from this book?

  • Explore the features of Struts 2.1 to develop your application
  • Enhance your web application by writing your own custom result type
  • Create your own type converter to handle custom data types
  • Automatically generate application and development documentation
  • Learn good exception handling practices for your applications
  • Implement rich client behavior using JavaScript, the DOM, and CSS
  • Create custom themes and templates to make shorter, cleaner JSP pages
  • Run many types of tests both to prove functionality and to make change safe


This book takes a clear approach, focusing on one topic per chapter, but interspersing other issues in the mainline text and in chapter detours. Taking a practical approach, it discusses agile web development using Struts 2, with plenty of examples for better understanding.

Who this book is written for?

This book is for Java developers who are interested in developing web applications using Struts. If you need a comprehensive introduction to Struts 2.1, along with the most important aspects of additional web application development technologies, agile programming practices, tool creation, and application life cycle management this book is for you. You don't need to know JavaScript and CSS to use this book as the author will teach you the required basics.

If you are a Struts 1 or WebWork user and wish to go ahead and migrate to Struts 2, this practical guide is also for you.



- 使用Struts 2框架設計、開發、測試和部署您的Web應用程序
- 不需要JavaScript和CSS的先備知識
- 應用最佳的敏捷開發技術和TDD技術
- 逐步的說明和詳細的解釋,並附有大量的代碼示例


Struts 2.1是一個現代、可擴展的敏捷Web應用程序框架,適用於小型和大型Web應用程序。

本書首先全面介紹了Struts 2.1的基礎知識,並穿插了更高級的開發主題。您將學習如何通過XML和Java註解配置Struts 2.1的操作、結果和攔截器。您將介紹大多數Struts 2.1自定義標籤,並學習它們如何幫助快速應用程序原型和開發。

然後,您將深入研究Struts 2.1對表單驗證和類型轉換的強大支持,這使您可以將表單值視為域對象,而不會使代碼混亂。最後,您將了解Struts 2.1攔截器,這是Struts 2.1拼圖的最後一塊,它允許您利用標準的Struts 2攔截器,並實現自己的自定義行為。

在介紹了Struts 2.1之後,您將進入JavaScript、文檔對象模型(DOM)和CSS的世界,並學習如何創建乾淨、簡潔的客戶端行為。您將利用這些知識,進一步研究Struts 2主題和模板,這為您提供了一種強大的方式來封裝整個網站的用戶界面行為。



- 探索Struts 2.1的功能以開發應用程序
- 通過編寫自己的自定義結果類型來增強Web應用程序
- 創建自己的類型轉換器來處理自定義數據類型
- 自動生成應用程序和開發文檔
- 學習良好的異常處理實踐
- 使用JavaScript、DOM和CSS實現豐富的客戶端行為
- 創建自定義主題和模板,使JSP頁面更短、更乾淨
- 執行多種類型的測試,以驗證功能並確保變更的安全性


本書採用清晰的方法,每章專注於一個主題,但在主線文本和章節中也穿插其他問題。以實用的方式討論使用Struts 2進行敏捷Web開發,並提供豐富的示例以便更好地理解。


本書適用於有興趣使用Struts開發Web應用程序的Java開發人員。如果您需要全面介紹Struts 2.1以及其他Web應用程序開發技術、敏捷編程實踐、工具創建和應用程序生命周期管理的重要方面,本書適合您。您不需要了解JavaScript和CSS,因為作者將教您所需的基礎知識。

如果您是Struts 1或WebWork的用戶,並希望轉向Struts 2,這本實用指南也適合您。