Servlets and JavaServer Pages: The J2EE Technology Web Tier (DevelopMentor Series)

Paperback (Print)
Buy New
Buy New from
Used and New from Other Sellers
Used and New from Other Sellers
from $6.37
Usually ships in 1-2 business days
(Save 88%)
Other sellers (Paperback)
  • All (15) from $6.37   
  • New (8) from $33.80   
  • Used (7) from $6.37   


Servlets and JavaServer Pages™ is the first complete guide to building dynamic Java-based Web applications using the new JavaServer Pages 2.0 and Servlets 2.4. Servlets and JavaServer Pages (JSP) provide a robust solution to developing large, complex Web applications, including multiserver projects. In addition to built-in security, portability, and a Web server, they offer developers the freedom to work with any operating system that supports Java—be it Linux, Windows, OSX, or Solaris.

This authoritative book begins by explaining how to set up a Servlet and JSP development environment, including a discussion of containers, Java support, and installing and configuring Tomcat. The authors then thoroughly explore servlets and JSP, including significant coverage of custom tag libraries, newly available filters, and popular servlet and JSP design patterns. Readers can then test-drive the knowledge gained by constructing a book-support Web site.

Among the topics covered in-depth are:

  • Exception handling
  • JavaBeans and the new JSP Expression Language (JSP EL)
  • The JavaServer Pages Standard Tag Library (JSTL) and coding custom tag libraries
  • Filters
  • Error handling
  • Session and state management
  • Security
  • Design patterns, including Struts
  • Internationalization
  • Multiclient support
  • Database connectivity

The actual book-support site ( features frequently asked questions, working code examples, and references.

With Servlets and JavaServer Pages™ as their guide, readers will learn how to fully harness the power of these flexible Java technologies.


Read More Show Less

Product Details

  • ISBN-13: 9780321136497
  • Publisher: Addison-Wesley
  • Publication date: 8/29/2003
  • Series: The DevelopMentor Series
  • Pages: 784
  • Product dimensions: 7.00 (w) x 9.10 (h) x 1.80 (d)

Meet the Author

A J2EE developer, Jayson Falkner is best known for managing the JSP Insider Web site, He has participated in the JSR 152 expert group and JSP 2.0 and helps with the Tomcat reference implementation.

A founding member of DevelopMentor UK, Kevin Jones is an active member of the Servlet 2.4, JSP 2.0, and JSTL expert groups. Since 1994, he has developed and delivered Java training on topics such as servlets, JavaServer Pages, and Enterprise JavaBeans. As a speaker at the JavaOne conference, he has discussed servlets, Filters JSP, and tag libraries.


Read More Show Less

Table of Contents


1. Setting up a Servlet and JSP Environment.

2. Java Servlets.

3. JavaServer Pages.

4. Exception Handling.

5. JavaBeans.

6. Custom Tag Libraries.

7. JavaServer Pages Standard Tag Library.

8. Filters.

9. Managing State in a Web Application.

10. Security.

11. Design Patterns.

12. Internationalization.

13. Multi-Client Support.

14. Database Connectivity.

15. Finale.

References: Charsets(i18n?), web.xml Schema, TLD.

Read More Show Less


The goal of this preface is to briefly but accurately introduce this book and its content. The preface is broken into four main parts: about the authors, an overview of the book's content, a list of the conventions used throughout the book, and an explanation of the book's cover. All parts are relevant to the book; however, not all parts may be of personal interest to you. It is suggested at least the first two sections be read because they explain who wrote this book and what the book is about. The last two sections are not helpful unless you decide to read any portion of the book.

About the Authors

Two authors collaborated on this book: Jayson Falkner and Kevin Jones. Both Jayson and Kevin are well-known developers in the JavaServer Pages (JSP) and Servlets communities, and both authors have worked extensively with the technologies. Servlets and JavaServer Pages™: The J2E™ Technology Web Tier originally started as Jayson's project; however, during the JavaOne 2002 conference the two authors met. It turns out Kevin was thinking of working on a similar title, and the two decided to collaborate.

Jayson Falkner

Jayson is a J2EE developer from the United States. He started developing with J2EE just before JSP 1.1 and Servlets 2.2 were released and has been focusing on the technologies since. Jayson is best known as the Webmaster of JSP Insider, , and for asking far too many questions in the popular Servlet and JSP forums. Jayson has worked on numerous JSP titles and is constantly present at the popular Java conferences. Jayson participated on the JSR 152 expert group, JSP 2.0, and helped with the Tomcat 5 reference implementation.

Jayson prefers to think of himself as a tax-dodging student, who is currently working on a Ph.D. in bioinformatics at the University of Michigan; however, he also works professionally as a J2EE consult with Amberjack Software LLC. Open-source software and free Java development are Jayson's specialties. You can thank (or complain) to Jayson for dictating the use of Mozilla and Tomcat with this book.

You can get in touch with Jayson by sending an email to .

Kevin Jones

Kevin is a longtime Java developer and educator, and has been involved in the training industry for the last twelve years. For the last eight years Kevin has been involved in writing and delivering Java training and consulting on various Java projects, and for the last four years has concentrated on J2EE and specifically Web technologies.

Kevin spoke at JavaOne in 2000 and was invited to become a member of JSR 53, the "Java Servlet 2.3 and JavaServer Pages 1.2 Specifications" and also JSR 52 "A Standard Tag Library for JavaServer Pages". Since then Kevin has successfully spoken at JavaOne in 2001 and 2002 as well as participating in JSR 154 (Servlets 2.4) and, like Jayson, in JSR 152.

Kevin is responsible for the Java curriculum at DevelopMentor, where he teaches the Essential Java Web Development class that covers much of the material in this book, as well as many other Java classes. You can reach Kevin at or through his Web site at .

How the Book Is Organized

In this book you will find a few, hopefully delightful, things. The book is a complete guide to Servlets and JavaServer Pages and their practical use for developers familiar with HTML and basic Java. If you are unfamiliar with the terms Servlets and JavaServer Pages, think of this book as a complete guide to building dynamic, Java-based Web sites. It is assumed you understand Java and HTML. Never does the book attempt to test these two skills; however, code examples in this book do not include explanations of fundamental Java concepts and HTML syntax.

Before introducing the book's content, there are a few points worth mentioning in relation to competing technologies, especially since you are likely standing next to several books about building Web sites using the plethora of other "superior" technologies. At all times this book follows the open-source mindset—that is, software you need is free and you get all the source-code. It will cost you or your development team absolutely nothing to get and use all the software demonstrated, both directly and indirectly. In comparison to the primary competitor of Servlets and JSP, Microsoft's .NET and Microsoft's ASP .NET, you will have no software costs, no licensing costs, and the freedom to choose any operating system that supports Java, such as Linux, Windows, OSX, and Solaris. Compared to other open-source solutions, namely PHP or Perl, this book offers a truly robust solution to developing Web applications. You will get everything you need, including built-in security, portability, and a Web server. A Servlet and JSP-based Web application does not need an additional Web server, such as IIS or Apache, installed to serve up Web pages and provide encryption for secure connections. Additionally, Servlet and JSP-based code, even code for multiple Web sites being run on the same server, can literally be packaged up into one big file and moved between a development environment and a production environment, even if the two places are using different operating systems—you can not do this with technologies such as PHP or Perl. Additionally, Servlets and JSP are an official part of J2EE, Java's solution to the hardest problems of application programming. If you plan on programming the largest and most complex ofWeb applications (including multi-server projects), this book still provides relevant code—surely a bonus compared to other popular, open-source technologies thatare not meant for large Web applications.

The table of contents provides a complete list of the book's contents, but the titles of most chapters are meaningless to a new user of Servlets and JavaServer Pages. Here is a complete description of the book's content, divided by chapters, explaining why the chapter is in this book:

  • Setting Up a Servlet and JSP Environment (Chapter 1): Before jumping straight to the technologies, you need to have two things: knowledge of why Servlets and JSP are important and a development environment (for Windows, Linux or OS X) for using Servlets and JSP. These two topics are covered completely in Chapter 1.While the content may not be something you will ever reference again in the future, it is a required introduction for new Servlet and JSP users.
  • Java Servlets (Chapters 2) and JavaServer Pages (Chapter 3): Chapters 2 and 3 provide detailed coverage of Servlets and JavaServer Pages. The chapters are not the most exciting of the book, but the material is needed as groundwork for the later chapters.
  • Exception Handling (Chapter 4): Web sites built using Servlets and JavaServer Pages provide specialized methods of handling exceptions. The mechanism is required in order to appropriately show a user-friendly error page when something goes wrong. Chapter 4 explains how Servlets and JSP extend the standard Java exception handling scheme. Since error handling is not commonly a well understood feature of Java, this chapter does not assume fluent use of Java's try-catch-finally statement.
  • JavaBeans and the JSP Expression Language (Chapter 5): The term "JavaBean" is used to mean many things in the Java world. As applied to Servlets and JSP, JavaBeans are little more than a fancy name for a simple Java class; however, the ambiguity of the term combined with its popular use merits a complete discussion about JavaBeans. Complementing this discussion is an introduction to the JSP expression language (new in JSP 2.0). The JSP expression language can greatly simplify the task JavaBeans were previously used for. Chapter 5 provides a complete discussion of the new JSP EL, and a discussion on good programming practices using both the JSP EL and JavaBeans.
  • JavaServer Pages Standard Tag Library (Chapter 6) and Custom Tag Libraries (Chapter 7): Custom Tags is a popular feature of JavaServer Pages that allow static text, such as HTML-like tags, to be linked with Java classes. The functionality is at the center of several popular JSP programming techniques, since it allows for a developer to easily abstract code from pages designed to display HTML. Understanding and using JSP custom tags is a skill every JSP developer should have. Chapter 6 covers the standard set of custom tags, and Chapter 7 is dedicated to explaining the mechanism of creating and using new custom tags.
  • Filters (Chapter 8): A Filter is something that a developer can use to cleanly intercept and modify requests and responses. The functionality works well for caching and security reasons; however, it is also conceptually a key part to building a good Web application. Chapter 8 explains Filters and provides several examples of how Filters are popularly used.
  • Managing State in a Web Application (Chapter 9): The vast majority of the World Wide Web relies on stateless protocols—that is, communicating with one user twice is by default indistinguishable from communicating with two users once. However, most every Web site relies on being able to keep track of who is receiving information. Chapter 9 details both the problem and common solutions. Servlets and JavaServer Pages provide a seamless solution to keeping state with a user, but it is very important as a Web developer that you understand how the problem is solved. Without such knowledge you may encounter unpredictable results from even a simple Web application.
  • Security (Chapter 10): Security is an all-important topic for an obvious reason: if information communicated via the Internet needs to be confidential something needs to guarantee confidentiality. The task of providing security is always in check by the persistence of people trying to break security. Servlets and JSP provide a relatively simple method of using up-to-date security mechanisms. Chapter 10 details how security works, how Servlets and JSP implements security, and how to configure a secure Web site.
  • Design Patterns (Chapter 11), Internationalization (Chapter 12), and Multi-Client Support (Chapter 13): Understanding how technology works does not mean one knows how to best use the technology. Complimenting the earlier chapters of the book, several popular tricks, techniques, and all-around good programming practices are explained in the last part of the book. This information is exactly the type of information a developer needs, assuming one understands the technology, and exactly the type of information omitted from books that only detail a technology. Chapter 11, Chapter 12, and Chapter 13 all explain popular approaches to using Servlets and JSP to solve real world problems.
  • Database Connectivity (Chapter 14): A database is almost always at the center of a Web site, for good reason; however, the topic of databases merits a full book. As a developer you will benefit from understanding the basic theories of databases and how a database can be used with Servlets and JSP. Chapter 14 provides a crash course to basic use of a database and a detailed discussion of using a database with Servlets and JSP. In practice Chapter 14 is no replacement for a good book on your favorite database, but Chapter 14 will enable you to create and use a database from scratch.
  • Building a Complete Web Application (Chapter 15): Ending the book is one grand look at everything covered and a discussion on how all the previous chapters are to be used in practice. How better to accomplish this then by building a real Web application? Chapter 15 uses all of the previous chapters to construct a book support site for this book, the same Web application seen online . The task is not difficult because it is little more than a rehash of the concepts covered in this book and recycling snippets of code, but the chapter nicely concludes the book and really proves you can build a good Web application based on the content of this manuscript.
You can do much with Servlets and JSP, and this book attempts to cover it all. If you read through the whole text you will be fluent with the technologies and able to take full advantage of them. Every chapter does rely on previous chapters. Concepts and buzzwords are explained fully only once in the book, in what is thought the appropriate place, and you are expected to read completely from the start to the end.

The Book Support Web Site

Servlets and JavaServer™ Pages: The J2EE™Technology Web Tier is not a perfect book, nor is everything the book covers best put in text. In a best attempt effort at ensuring the book is top quality, even after publication, a book support site is maintained at . At the book support site you will find numerous things including current updates, FAQ, news about the book, working code examples, references, and a method to reach the authors. This book support site is not the standard publisher-supported site (and Addison-Wesley's site is quite nice), but it is something created and supported completely by the authors. You are encouraged to use the book support site as a place to aid your reading of the book and communicate with the authors.

Conventions Used in the Book

For clarity, a few arbitrary conventions are followed by this book. As authors our goal is to try and convey our thoughts and experiences clearly. Where possible we attempt to follow standardized or de-facto coding methods and writing techniques. In cases where we have to make up a method of conveying information it needs to be clear that we are doing just that. Documented here are all of the arbitrarily official standards that are used in this book.
InTextCode Style
When dealing with technical information there are times when terms are ambiguous. One word in English might be spelled and pronounced exactly the same in code but refer to a completely different meaning. In cases where a literal name or value of a technical term is used, it will always appear in the InTextCode style. This style signifies that the word is a direct reference to a file, variable name, Object type, or any other specific code reference.
Throughout the book there are many examples of code. These examples are all thoroughly tested and are functional illustrations of a point at hand. For the most part code is always intended to be helpful. However, sometimes an example relies on having a particular situation or circumstance occur to be meaningful. In these cases a slightly contrived bit of code might be required to illustrate what the important example is doing. In these cases the contrived code is not meant to be helpful beyond educational purposes. In order to distinguish clearly between what code is slightly contrived and what code is actually helpful a convention is used to flag purely educational code. Whenever the foo keyword appears in code, you should be suspect of its practical use. Some examples of places where foo appears include package and code that is named with foo appearing in the title. In the case of the package the foo keyword means code in this package is not too helpful on its own. Instead, classes are usually built to directly complement a helpful class appearing in the com.jspbook package. When the foo keyword appears in the title of code, perhaps a JSP named Foo.jsp, it signals the whole page is slightly contrived. Be conscious of occurrences of the foo keyword and do not focus on them but rather the point they illustrate.
Mozilla and Tomcat
For consistency two primary pieces of software, Mozilla and Tomcat, are used throughout the book and will be indirectly visual in examples. As further explained later, all JSP and Servlets rely on a main piece of software called a container. The reference container for JSP is Tomcat, . All code in this book is tested against Tomcat, and many screenshots show common behavior of the container. Be aware that Tomcat is the specific container in all of these cases, and different containers might have slightly different results. This warning does not imply that the code would not work in other containers; code should seamlessly work on any JSP 2.0 and Servlet 2.4 container. The mention is solely to prevent possible confusion that might arise from examples that give different styles of the same result when executed.Mozilla is the very popular open-source Web browser that is built with an emphasis on compliance to Internet standards. The results of a JSP or Servlet are almost always intended for rendering by a Web browser. In almost every screenshot the Web browser is visible. This browser is Mozilla, , unless specifically mentioned otherwise. Mozilla was chosen because it is both a truly superb piece of software and because it behaves in a way that is to be expected by other Web browsers.

The Book's Cover

The cover of this book shows 3/4 of a yard-gnome. A yard-gnome1 is a ceramic gnome that is intended to decorate a yard. Gnomes themselves are fictitious creatures that have little if anything to do with yards. A question you might be asking is "What do yard-gnomes have to do with Servlets and JSP or the J2EE Web Tier?" The answer is absolutely nothing. The cover resulted from a style restriction we had to use for this book and a bad joke that has obviously eluded far too many people.

Yard-Gnomes on Holiday and Yard-Gnomes in France

Being that a yard-gnome does appear on the cover, two things are suggested of creative readers. Traditionally yard-gnomes are hidden in the background of pictures, particularly vacation pictures. Take a picture with this book hidden in the background and email it to the book support site. Your picture will be displayed unless it grossly violates the laws that govern common sense. Additionally, it is fun to note that in France there is a serious problem of gangs stealing yard gnomes and returning them to "their natural habitat" or forested areas, particularly city parks. If you can think of some way to replicate this phenomena using the gnome on this book's cover, please send a picture via email to the book support site.
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 3 Customer Reviews
  • Anonymous

    Posted February 13, 2004

    Not that good for novice JSP programmers

    Not a good start if you're beginning to developed in JSP

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted January 23, 2004

    Hidden Treasure

    I was at the 57th Street store looking for a different book, and when they didn't have it on the shelf I peeked at this one because of the tiny little Addison Wesley logo down at the bottom of the binder. I opened the book to a random location and by the end of the first sentence I read I knew I had found a good one. I skimmed a couple of topics I was interested in, and was so impressed with the clear, succinct, intelligent style of presentation that I didn't bother looking at any other titles and headed straight for the checkout line. In keeping with Addison Wesley's usual standard of high quality, the book is written in a way that makes it easy to grasp the material quickly and thoroughly. Jayson and Kevin consistently find just the right depth of coverage that is appropriate for a web application developer without getting bogged down in details that would only be of interest to a J2EE container developer. They do move along pretty quickly though, and you won't get far if you don't have a reasonably good understanding of Java. If you feel a bit overwhelmed by this book, then you might want to get your feet wet first with something directed a little bit more toward the beginner--Perhaps start with Ivor Horton's 'Beginning Java 2' or Bruce Eckel's 'Thinking in Java', and then run through 'Core Servlets and JavaServer Pages' by Marty Hall. Then you'll be ready to quickly take your JSP/Servlet programming skills up to the expert level with this book.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted October 28, 2003

    What to use for Web Development

    To build a web application that generates dynamic web pages leads you immediately to a crossroads. Do you stick to the old, original CGI, or do you use a newer, more powerful language? Of the latter, you might choose PHP, Perl or JSP/servlets. These are all free. But the book's authors argue strongly that the last choice is the most portable and expressive for large scale web applications, because it is used at the heart of J2EE for such problems. Experienced developers of PHP or Perl might reply that their languages are just as powerful for handling web apps. Indeed, a computer science theorist might say that if PHP and Perl are Turing complete (as I think they are), then they can certainly express anything JSP/servlets can, so what is the issue? To answer this, you can regard the book as written on two levels. The most immediate is when it offers a detailed exposition of the properties of JSP/servlets. But at a deeper level, it offers a rebuttal to the other languages, or indeed also to Microsoft's offering. In essence, by being an extension of java, JSP/servlets give you a programming language that is fully object oriented, which makes coding more robust and scalable. You also get the java built in security and exception handling. Plus all the internationalisation. By contrast, take Perl, for example. Very powerful at parsing, and incredibly compact notation. But the latter makes for harder debugging. And it is not very object oriented, so writing large code bodies can get awkward fast. But what about using Microsoft's offering? It really is on a technical par with JSP/servlets for most things. Perhaps the biggest advantage of the latter is simply the zero licensing cost. Followed by the greater mindshare in the marketplace. If you are a web developer and you are not totally committed to your current language, then it behooves you to at least consider the alternative presented in this book.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 3 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)