There are any number of good introductory texts on JavaServer Pages. This title distinguishes itself with techniques recommended by Sun for building better Web applications. Backed up by the author's own collection of custom tag libraries, which allow ordinary Web designers to program with tags instead of Java code, this text covers all the bases from getting started with tags to more advanced techniques. Early examples of tag libraries include a variety of ways to validate data in HTML forms. Throughout, the book deftly describes installing tag libraries, and shows how HTML designers can use custom tags after Java developers have created them.
Readers also get best practices for JSP and Beans, which is a big plus. Author David Geary presents both Model 1 and Model 2 architectures. (In Model 1, JavaBeans are used to present data to front-end JSPs. In Model 2, a more sophisticated set of Java classes using the Model-View-Controller design pattern allows even greater flexibility.) Sample code for using JSP and JavaBeans for internationalized code (including French, German, and Chinese) will show you how to take your Web application to worldwide markets. The book concludes with a working case study of an online fruit stand (using several languages) and applies the techniques presented earlier on.
All in all, with its mix of practical advice and some very useful techniques for getting the most out of JSP and Java for Web applications, Advanced JavaServer Pages fills a valuable niche for any serious Java developer who wants to see some of the best ways to create Web applications today. --Richard Dragan
Topics covered:
Shortly after the Swing volume of Graphic Java was published in March 1999, I became aware of the mass exodus from client-side Java to server-side Java. Because I make a living writing books, I took that exodus very seriously, so I began exploring server-side Java in search of a technology that would be appropriate for my next book. At first, I was enamored with XML, XSLT, and Java, and I spent a good deal of time experimenting with those technologies. But as exciting as those technologies are, it seemed to me that they were on the periphery of developing web applications, and I wanted something that was directly involved in the creation of web applications. Then I discovered servlets.
To be honest, I wasn't too excited about servlets. Were software developers really going to create user interfaces by generating HTML with print statements from the guts of some servlet? I knew of at least one software developer that was not. Since 1984, I've had the good fortune to develop software by using a number of object-oriented languages and very cool user interface toolkits. I've developed applications in Smalltalk, Eiffel, and NeXTSTEP, and it seemed to me that developing applications with HTMLespecially HTML manually generated from servletswas akin to trading in a Ferrari for a Yugo. Then I discovered JSP.
Although back in 1999 JSP was in its infancy, it was easy to see its potential. Here was a way to mix Java with HTML, which opened the door to all kinds of interesting possibilities. And in the Future Directions section of the JSP 1.0 specification, I saw something that really caught my eye: A portable tag extension mechanism is being considered for the JSP 1.1 specification. This mechanism permits the description of tags that can be used from any JSP page. Wow. With custom tags you could encapsulate Java code, which would essentially allow you to create custom components, in the form of tags, that could be used in conjunction with HTML. From then on, I knew that my next book would be about JSP.
So I started to write an introductory JSP book, and I actually wrote the first chapter of that book before I realized two things. First, there was going to be a glut of introductory JSP books, and I did not want to compete against all of those books. Second, and most important, that first chapter was boring, and I hate to read boring books, let alone write them. So, I decided to write this book instead.What This Book Is About
As its name suggests, this book is an advanced treatment of JavaServer Pages. The central theme of this book is the design and implementation of flexible, extensible, and maintainable applications with beans, servlets, and JSP.
This book begins where most introductory JSP books leave off, by showing you how to implement JSP custom tags. The ability to create custom tags is arguably JSP's greatest strength because it allows software developers and page authors to work in parallel with few dependencies. Subsequent chapters cover HTML forms, JSP templates, Model 1 and Model 2 architectures, a simple Model 2 framework, handling events, internationalization, security, databases, and XML. This book concludes with a comprehensive case study that shows how to use the techniques discussed in this book to develop a nontrivial web application.The Servlet and JSP APIs This Book Depends Upon
The code in this book depends upon the Servlet 2.2 and JSP 1.1 specifications. Although the Servlet 2.3 and JSP 1.2 specifications were first released in draft form in November 2000, as this book went to press they were still in a state of flux. Because servlet filters are arguably the most important addition to the Servlet 2.3 specification, that topic is covered in "Servlet Filters" on page 471; however, you should be aware that the code in that appendix is very likely to change by the time you read this.How This Book's Code Was Tested
I tested all of the code in this book with Tomcat 3.2.1. If a code example from this book does not work correctly with Tomcat 3.2.1, such as the example in "Digest Authentication" on page 259, that fact is pointed out in the book's text.
Because Tomcat is the reference implementation for the Servlet and JSP specifications, all of the code in this book should work with any servlet container that conforms to the Servlet 2.2 and JSP 1.1 (or higher) specifications. If an example from this book does not work with your servlet container, it is most likely a bug in that servlet container.
I also tested all of the code in this book against Resin 1.2, which is an excellent servlet container available from caucho. As a general rule, it is beneficial to test your code against more than one servlet container to ensure correctness and portability.This Book's Audience
This book was written for Java developers with a basic understanding of servlets and JSP. For most Java developers, this should be their second book that covers servlets and JSP. If you are new to servlets and JSP, I recommend the following books for your first book on those topics:
Core Servlets and JSP by Marty Hall, Sun Microsystems Press
Java Servlet Programming by Jason Hunter, O'Reilly
Web Development with JavaServer Pages by Fields and Kolb, Manning
It also won't hurt to have a basic understanding of design patterns and the Unified Modeling Language (UML). This book demonstrates how to implement a number of design patterns in JSP-based web applications and uses UML class and sequence diagrams to show how classes are related and how they interact, respectively. See page 181 for a list of resources on design patterns and UML.
This book was not written for page authors. If you are a page author with no Java experience, you will be better served by one of the books listed above.How This Book Was Written
Designing object-oriented software is very much an iterative process. You start with a few classes and build on them, all the while iterating over classes, both old and new, as you integrate them to build an ever-evolving system. In object-oriented parlance, that process is known as refactoring.
After working for 15 years as a software engineer, I tend to write books the way I write software. Each of this book's chapters started out in humble fashion. And each chapter was subsequently refactored into the final product that you hold in your hands.
You can get a glimpse into this process by looking at a JavaWorld article that I wrote about JSP templates. That article is the first cut of this book's Templates chapter, so you can see where the process started for that chapter and where it ended; both the chapter and the code that it discusses underwent much refactoring.How To Use This Book
This book is not a novel, so I don't expect anyone to sit down and read it cover to cover. Because most readers will read chapters out of order in a random fashion, nearly every chapter in the book can stand on its own. There is one exception to that rule. Chapter 6, which discusses a simple Model 2 framework, depends on Chapter 5, which introduces the Model 2 architecture. Chapter 6 retrofits an example from Chapter 5; therefore, Chapter 5 is a prerequisite for Chapter 6.
The last chapter in this book is a comprehensive case study that employs the techniques discussed throughout this book to implement a nontrivial web application. You can read (or most likely, skim) that chapter first to get a feel for those techniques, or you can read it last to see how to integrate those techniques. Or you can do both.This Book's Custom Tag Libraries
This book discusses the implementation of approximately 50 JSP custom tags, ranging from internationalization tags to tags that use XML's Document Object Model to parse XML. There are no legal restrictions whatsoever on those tags, so you are free to use those tags in any manner you deem appropriate. See "This Book's Code" on page xvii to see how you can download those tags.
This book's custom tags serve two purposes. First, they illustrate how you can implement your own custom tags. Second, they serve to reinforce the concepts discussed throughout this book. But those custom tags are not the focus of this book; rather, it's the concepts that those tags embody that are important. For example, if you look at the internationalization chapter, you will see that most of that chapter is dedicated to internationalizing text, numbers, dates, and currency in a JSP-based web application. The last few pages of that chapter show how to implement two custom tags that perform internationalization. But it's the internationalization concepts, and not the custom tags, that take center stage in that chapter.This Book's Code
You can download all of the code from this book, including the book's custom tag libraries, from the following URL: phptr/advjsp
Product Details
Would you like to update product info or give feedback on images?
|
|
Share your thoughts with other customers:
|
||||||||||||||||||||||
|
Most Helpful Customer Reviews
19 of 19 people found the following review helpful:
5.0 out of 5 stars
Awesome Design Patterns for Servlets and JSP,
By Richard Kennedy (Huntsville, Alabama) - See all my reviews
This review is from: Advanced JavaServer Pages (Paperback)
I have several books on servlets and JSP, and while some of them are quite good (I would recommend Core Servlets and JSP or Web Development with JSP), none of them cover the advanced aspects of JSP that Geary's book does.Geary starts with two excellent chapters on implementing custom tags, which includes a clear explanation of how body tags work, which was something I didn't really understand before reading this book. From there, Geary shows best practices for handling forms, implementing templates and the Model 2 architecture, event handling, internationalization, security, interacting with databases, and XML. The book concludes with a comprehensive case study that uses most of the concepts previously discussed in the book. The best thing about this book, however, is that it shows you how to apply a number of design patterns discussed in the GOF book for servlets and JSPs. Those design patterns allow you to implement robust Web sites that are easy to maintain and modify. For example, Geary shows how to use the façade design pattern to handle forms and the memento pattern to retain form values. In what is arguably the most interesting chapter in the book (Templates) Geary shows how to use the Composite and Strategy design patterns to implement templates. Templates let you construct web sites with pluggable components, which makes those sites much easier to implement and, more importantly, modify. I have not seen templates covered in any other JSP book. Finally, Geary's book is extremely well written -- it's authoritative and easy to read, contains a great deal of information that you won't find elsewhere, and unlike most technical books, does not contain a bunch of fluff. You won't find rambling discussions of things you already know, useless appendices that repeat what you can easily find in the javadocs, or long code listings that could be much shorter. Every page in Geary's book is packed with useful information that's presented clearly in a logical progression.
17 of 17 people found the following review helpful:
5.0 out of 5 stars
Not your run-of-the-mill JSP book,
This review is from: Advanced JavaServer Pages (Paperback)
I've looked through probably every book under the sun (no pun intended) pertaining to the subject of JSP, and while there are some good things in many of them, I can't think of one that has as much useful information between the covers as Geary's book does. Unlike most of the books on the subject that describe what JSP can do, Geary's book is a thoughtful exposition of how best to do it. His central theme is the use of custom tags to manage the complexity of JSP applications. His first 2 chapters describe how custom tags are built and used in web pages. But for my money, it is the 4 chapters following these that are the real highlight of the book, the ones dealing with HTML Forms, Templates, and the Model 2 Framework. These chapters provide really useful information for the architectural design of web sites using JSP technology. I found Geary's explanation of these subjects to be clear, concise, and complete - something I can't say about Sun's Blueprint book. Finally, it was refreshing NOT to find the 'obligatory' appendixes with the entire Servlet and JSP APi at the end of Geary's book. Instead, there is just one lone appendix dealing with the subject of Servlet filters.
17 of 18 people found the following review helpful:
5.0 out of 5 stars
Superb, real-world JSP Application Architecture,
By Robert Stokes (Philadelphia, PA USA) - See all my reviews
This review is from: Advanced JavaServer Pages (Paperback)
Advanced JSP is an incredibly useful book; it provides the essential design framework for implementing real-world JSP applications. Geary outlines three critical JSP architecture patterns: (1) a template-driven approach for structuring web page layouts; (2) a Model-View- Controller (MVC) framework to separate presentation and business logic; and (3) a custom-tag based pattern for controlling database access. The text and the examples are clearly written and illustrated; in explaining each concept, Geary starts with a straightforward example, and then effectively builds additional sophistication upon it. As a project manager with my first JSP assignment, this book provided the key design principles. When I shared the book with my Java development team, they were even more enthusiastic; they shared the book with two other development teams who are going to incorporate his ideas. One senior Java developer indicated that if he had implemented Geary's framework on his previous JSP project, they could have written a much more robust application with 75% less code. Geary's design patterns take care of most of the application infrastructure; it will allow my development team to focus on coding business-specific components -- and not on the underlying "plumbing".
Share your thoughts with other customers: Create your own review
|
|
Suggested Tags from Similar Products(What's this?)Be the first one to add a relevant tag (keyword that's strongly related to this product).
|