Book Image

Learning Jakarta Struts 1.2: a concise and practical tutorial

By : Stephan Wiesner
Book Image

Learning Jakarta Struts 1.2: a concise and practical tutorial

By: Stephan Wiesner

Overview of this book

<p>Jakarta Struts is an Open Source Java framework for developing web applications. By cleanly separating logic and presentation, Struts makes applications more manageable and maintainable.<br />Since its donation to the Apache Foundation&nbsp; in 2001, Struts has been rapidly accepted as the leading Java web application framework, and community support and development is well established.<br /><br />Struts-based web sites are built from the ground up to be easily modifiable and maintainable, and internationalization and flexibility of design are deeply rooted. Struts uses the Model-View-Controller design pattern to enforce a strict separation between processing logic and presentation logic, and enables efficient object re-use.<br /><br />The book is written as a structured tutorial, with each chapter building on the last. The book begins by introducing the architecture of a Struts application in terms of the Model-View-Controller pattern. Having explained how to install Jakarta and Struts, the book then goes straight into an initial implementation of the book store. The well structured code of the book store application is explained and related simply to the architectural issues.<br /><br />Custom Actions, internationalization and the possibilities offered by Taglibs are covered early to illustrate the power and flexibility inherent in the framework. The bookstore application is then enhanced in functionality and quality through the addition of logging and configuration data, and well-crafted forms. At each stage of enhancement, the design issues are laid out succinctly, then the practical implementation explained clearly. This combination of theory and practical example lays a solid understanding of both the principles and the practice of building Struts applications.</p>
Table of Contents (20 chapters)
Learning Jakarta Struts 1.2
Credits
Preface
About the Book
Glossary
Literature

About the Book

This book is a rapid and effective Struts tutorial for Java developers. It is a step-by-step introduction to building Struts web applications. The book builds a fully-featured online bookstore application incrementally, with each stage described in detail.

What This Book Covers

Each chapter begins with a short introduction and ends with in-depth questions and a short summary. Each chapter builds up on the previous one. Those readers who are already familiar with Struts can skip individual chapters, but they should at least skim through those chapters, so they won’t lose the plot and it will also help them to keep up with the web application development part of the book.

Here is an overview for the content of the each chapter:

Chapter 1 presents an overview of Struts in compact form.

Chapter 2 explains the installation for the Struts and shows the first, very easy example. The aim is to start working and experimenting with a fully running system. If you have worked with Struts before, you can skip this chapter.

Chapter 3 introduces the concept the book is based on—the web application called the "Book Store". This will be built, expanded and adapted step-by-step in the following chapters. The underlying design will be introduced in this chapter.

Chapter 4 discusses Internationalization—the possibility to adapt the text of a web site for different languages. Here are some further information and tricks: Custom Actions are explained and a particular Custom Action will be developed.

Chapter 5 emphasizes the importance of correct logging and use of configuration data for software quality. This chapter presents different implementation approaches.

Chapter 6 discusses forms. Handling forms is a standard problem. Error handling in particular generally requires the same mechanisms. Struts offers various possibilities for simplifying this task. Furthermore, this chapter gives insight on how to access databases.

Chapter 7 introduces Logic Tags which allow us to manage conditional generation of a web page via HTML tags. Logical statements such as Loops and If statements are explained in this chapter.

Chapter 8 discusses error handling, the central element of any application. A well-designed shop will always display an error message; after all it’s about the customer’s convenience.

Chapter 9 discusses the controller and templates. The basic process for the controller in the Model 2-concept is manually implemented and subsequently explained for Struts. Templates (Tiles) allow modular design of the web site and easy alteration.

Chapter 10 is quite an extensive chapter where the elements of the shop are further expanded and merged together as one package. Authorization is implemented, a shopping cart is built and the order process completed.

Chapter 11 offers interesting additional information on Struts independent of our online shop.

Chapter 12 discusses JSTL—frequently called a successor of Struts. Here is a short overview of how these two techniques can be combined together.

Chapter 13 gives useful tools and enhancements for Struts as well as practical solutions for frequently encountered problems.

Appendix A is the Solutions section. Here you will find answers to several exercises. Do yourself a favor and look into this section only after you have solved the problem yourself!

Appendix B contains a Glossary explaining important concepts.

Appendix C contains Literature where you will find some more book tips.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

New terms and important words are introduced in a bold-type font. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: "clicking the Next button moves you to the next screen".

Note

Tips, suggestions, or important notes appear in a box like this.

Reader Feedback

Feedback from our readers is always welcome. Let us know what you think about this book, what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply drop an e-mail to, making sure to mention the book title in the subject of your message.

If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or e-mail.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer Support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the Example Code for the Book

Visithttp://www.packtpub.com/support, and select this book from the list of titles to download any example code or extra resources for this book. The code files available for download will then be displayed.

Errata

Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing this you can save other readers from frustration, and help to improve subsequent versions of this book.

If you find any errata, report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the Submit Errata link, and entering the details of your errata. Once your errata have been verified, your submission will be accepted and the errata added to the list of existing errata. The existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Questions

You can contact us at if you are having a problem with some aspect of the book, and we will do our best to address it