Java Server and Servlets: Building Portable Web Applications
Authors: Peter Rossbach, Hendrik Schreiber
Venue:  (2000)

From the Book:This book is supposed to be about servlets. When we began developing our first servlet-based application in Autumn 1997, we were forced to accept that there was no printed literature on the subject. Admittedly, a very active group formed in the Web and particularly in a variety of mailing lists - but we were still kept waiting for printed material. The Apache JServ project developed one 0.9.x version after the other (http://java.apache.org), Sun launched the Java Web Server on the market and IBM followed up with ServletExpress, the early fore-runner of today's Websphere. At the same time, Live Software came along and made a big impression with their plug-in JRun. But all this time, there was still nothing put down, black on white - apart from a few short articles in the relevant technical publications (Heid 1997, Rossbach and Schreiber 1997). After our first attempts we rapidly came to realize that the pure servlet API promised small and beautifully formed solutions for just such problems, but would not help us achieve a major breakthrough. This led to the birth of the first idea for extending the API, which we later christened Servlet Method Invocation (SMI). This extension, based on the servlet API, made it possible for us to build robust and configurable applications. Then, one thing came after another: we needed a configuration manager, and object-related mapping for databases, and then we wrote our own servlet engine, jo!. We had created a framework, the WebApp framework. During development we laid a great deal of value on keeping all components as flexible as possible. Only a few of the dependencies within the WebApp framework are reallyhard-coded. Most of them are detached via interfaces. You can read more about this design principle in Part II of this book. Owing to all these activities, the actual servlet programming was pushed ever further into the background, in favour of ideas concerning the application and server architecture, a powerful layer for saving object networks and applications for the framework. For this reason, the book may give the impression, in some places, that it explains a few things about a large number of subjects, but never does anything in depth. Our objection to that impression is that the book definitely does one thing: it explains how to build Web-based applications. The fact remains that you need certain ingredients, such as servlets, a servlet engine, an extension such as SMI and a persistence layer, to do so. We believe that you need all these elements, together, to be able to work efficiently. What use is it, to write a great mail servlet, if you cannot integrate it in your application? What use can you have for program code that includes SQL statements that are almost impossible to maintain? What do you do if your application suddenly has to have its own, more convenient and easy-to-use client and should no longer work only with Web browsers? You can respond to all these questions calmly if you have taken a critical look at a few issues when you began developing your software - and not just with servlet programming in its natural state and 'raw' JDBC (Java DataBase Connectivity). The framework presented in this book is certainly no wonder cure. However, it can help you to develop better applications. Even if you never use it, you will get a feel for the problems you have to overcome. There are now a few good books about servlet programming (Moss 1998, Hunter and Crawford 1998). Even though the first part of this book covers servlet programming, it is not a pure servlet book. It is a book about the architecture and the building of servlet-based applications. The software for the book As this subject develops very rapidly and the life of software and the documentation that goes with it generally appears to be getting shorter, we decided not to include a CD-ROM with this book. Instead, there is a Web site for the book. http://www.webapp.de. We recommend that you download the WebApp framework from the website, so you can work through and understand the example applications yourself. Notation in UML In all three parts we have used diagrams to give you a clear view of the design and processes. The notation we used is UML (Unified Modelling Language) 1.0 (Oestereich 1998). To create the diagrams we used Rational Rose for Java. Questions and suggestions We welcome open dialogue about this book and the servlet scene. For this purpose we have created the mail address book@webapp.de. Please send us your thoughts, suggestions, inspirations and ideas for improvements. They will be heartily welcomed. Our thanks We would like to thank our colleagues in FACTUM Projektentwicklung und Management GmbH, Phillip Ghadir, Michael Jrgens, Wolfgang Neuhaus, Frank Peske, Henning Steiner and Axel Terfloth, for their willingness to again and again correct and comment on yet another chapter. We also thank all members of the intraNEWS team who created a distributed information system based on a servlet-based application server with us, during a period of 14 months, for their ideas and their hard work. At the end of the day they played an important role in motivating us to write this book. We owe a special thank you to Frank Wegmann for his accurate and constructive criticism. Owing to his perfectionism, we were able to see many things in the proper light for the first time. In addition we would like to thank Ulrich Bttgen who put earlier versions of the framework and the book under the microscope and gave us valuable advice. Furthermore we give our thanks to our reader, Susanne Spitzer, for her uncomplicated way of working with us and the freedom that she gave us when we were creating this book. It has become a rather different Java book and we hope that it will be rewarded with success. Peter Rossbach I would like to thank my family. Special thanks to my wife, Regina Potthoff, for her patience and the encouraging support she gave me during difficult phases. To my daughters Josephine and Vivienne for the incalculable joy and refreshing change they gave me. Josephine has given us her name for the jo! servlet engine and her helpful words of consolation - 'Everything will be all right!' - pushed me to finish the book. Hendrik Schreiber I want to thank everyone who helped me write this book - especially Barbara, Rolf, Marc, Bernd and Enke. Without their support, understanding and patience, and a few nights in the 'Keller' and 'Soundgarden', this book would never have been created.