Java Servlet & JSP Cookbook
Practical Solutions to Real World Problems
By Bruce W. Perry
Publisher: O'Reilly Media
Final Release Date: January 2004
Pages: 748

With literally hundreds of examples and thousands of lines of code, the Java Servlet and JSP Cookbook yields tips and techniques that any Java web developer who uses JavaServer Pages or servlets will use every day, along with full-fledged solutions to significant web application development problems that developers can insert directly into their own applications.Java Servlet and JSP Cookbook presents real-world problems, and provides concise, practical solutions to each. Finding even one tested code "recipe" that solves a gnarly problem in this comprehensive collection of solutions and best practices will save hours of frustration--easily justifying the cost of this invaluable book.But "Java Servlet and JSP Cookbook" is more than just a wealth of cut-and-paste code. It also offers clear explanations of how and why the code works, warns of potential pitfalls, and directs you to sources of additional information, so you can learn to adapt the problem-solving techniques to similar situations.These recipes include vital topics like the use of Ant to setup a build environment, extensive coverage of the WAR file format and web.xml deployment descriptor, file-uploading, error-handling, cookies, logging, dealing with non-HTML content, multimedia, request filtering, web services, I18N, web services, and a host of other topics that frustrate even the most seasoned developers.For Java web developers of all levels who are eager to put into practice the theory presented in other API-focused books, the solutions presented in this practical book will prove invaluable over and over again. This is painless way for less experienced developers who prefer to learn by doing to expand their skills and productivity, while accomplishing practical solutions to the pressing problems they face every day. More experienced developers can use these recipes to solve time-consuming problems quickly, freeing up their time for the more creative aspects of their work.

Table of Contents
Product Details
Recommended for You
Customer Reviews


by PowerReviews
oreillyJava Servlet & JSP Cookbook

(based on 5 reviews)

Ratings Distribution

  • 5 Stars



  • 4 Stars



  • 3 Stars



  • 2 Stars



  • 1 Stars



Reviewed by 5 customers

Displaying reviews 1-5

Back to top


good but dated?

By john w

from va

About Me Developer

Verified Buyer


  • Concise
  • Easy to understand
  • Helpful examples
  • Well-written


    Best Uses

    • Intermediate
    • Novice

    Comments about oreilly Java Servlet & JSP Cookbook:

    Its exactly what it says it is: a series of problems with their worked solutions. Reading it I couldn't help feeling that some of the info was quite dated. But then again, this isn't the latest technology. Good structure, and the writing is very close to english for a Software engineering book.

    (0 of 2 customers found this review helpful)



    By rufik

    from Undisclosed

    Comments about oreilly Java Servlet & JSP Cookbook:

    I am from Azerbaijani and read this book in Russian language This book is the most popular book about servlet and JSP in our country Thanks,Bruce for this book

    (1 of 3 customers found this review helpful)


    need help

    By cougarwww

    from Undisclosed

    Comments about oreilly Java Servlet & JSP Cookbook:

    How and where I can get all the examples but not the ? thanks!

    (4 of 4 customers found this review helpful)



    By Jez

    from Undisclosed

    Comments about oreilly Java Servlet & JSP Cookbook:

    While this book is certainly very wide-ranging, I think it achieves this at the expense of detail.

    I bought this book essentially because I know a fair amount about JSPs and servlets, but wanted to research i18n, security, the jstl and the new 2.4 stuff. I also wanted the kind of tips and tricks that cookbooks normally provide in abundance.

    While it provides a reasonable guide to pretty much everything, it certainly does not stand on its own - you WILL need to supplement it with other books or internet resources. For example, I needed to access the elements of a HashMap using the JSTL tag - but while the cookbook tells you the basics of the syntax, it doesn't tell you how you access the name/value pairs specific to this type. Conversely, however, it provides rather simple and vendor-specific chapters like "Deploying an individual JSP on Tomcat".

    I think a little less boilerplate text and a bit more information would make this a killer book. As it is, it is certainly useful, but I would not recommend it as the one book to buy on this topic.

    (5 of 5 customers found this review helpful)


    A Must Buy

    By Vinny_Carpenter

    from Undisclosed

    Comments about oreilly Java Servlet & JSP Cookbook:

    In the great tradition of cookbooks, O'Reilly has published the Java Servlet and JSP Cookbook. This book, written by Bruce W. Perry is a must-own book for anyone working with web applications in the Java space. I've been a Java developer for almost 8 years now and have been working with Servlets since early 1999 and I've learned quite a few things from this book.

    The Java Servlet & JSP Cookbook provides more than 200 'recipes' or fully working and documented code snippets that you can directly cut-and-paste in your application. The book starts off with a quick intro to writing servlets and JSP pages. I was very impressed that the first JSP page that you write uses JSTL and is not loaded up with scriptlet code. I am just sick and tired of arguing with people with scriptlets are bad and it's nice to see a book that starts off with JSTL. Kudos Bruce.

    Once the intro is complete, you move onto writing deployment descriptors, deployment and then move on to Ant. One of the most common question people ask after deploying JSP based application is the idea of precompiling JSPs for performance reasons. The fifth chapter does a great job of suggesting several methods of precompiling JSPs. I should also mention that the book includes how-to guides for Tomcat and WebLogic, which covers a pretty large landscape of web containers. WebSphere, Resin, Jetty are not directly covered but who uses anything but WebLogic, right? :)

    The book then moves on and covers topics such as handling Form data via POST/GET, uploading files, cookies, session tracking and URL rewriting. There is also a chapter on JavaScript and how they use JavaScript with servlets. I don't really understand the point of this chapter as most users just need a few cut-n-paste JavaScript for client-side FORM validation. There is also a chapter on streaming non-HTML content such as PDF, audio/video files and others to the browser.

    I also liked the chapter of logging in Servlets and JSPs. This chapter includes a nice introduction to Log4j and a nice tag library that uses Log4j under the cover. My favorite chapter in this book was the chapter dealing with authentication. The chapter starts off by talking setting users in Tomcat and then moves into setting up BASIC authentication. The next recipe talks about using Form-based authentication. The chapter is rounded off with a good treatment of the Java Authentication and Authorization service (JAAS). In this chapter, you create your own custom LoginModule and then use JAAS in a servlet and JSP.

    There is also a chapter about embedding multimedia content inside JSPs. This is not something I'm really interested in and I just glossed over this chapter. The same goes for the next chapter on manipulation of the HttpRequest. The next chapter does a great job of exploring Servlet Filters, which is a great feature introduced in the Servlet 2.3 specification that hasn't really caught on. Filters are great and the book includes some great examples of how best to use them.

    The next section includes chapters on sending, accessing email from servlets along with database access. Most complex application usually will implement some backend service to access database and separate the business logic from the data and the data from the UI, but the included recipes will help get you up and running for simple application.

    I really liked the section on custom tag libraries and JSTL. Tag Libraries are a great way to avoid scriptlet code in JSPs. The chapter on JSTL is also fairly comprehensive and includes code snippets for the core, XML, format, and SQL tags. There is also a great section on the Expression Language (EL) which has been migrated from JSTL 1.0 to the JSP 2.0 specification.

    I could go on about this book but I won't bore you any longer, assuming you are still reading. I highly recommend this book for anyone doing any type of Web development using Servlet and JSPs. I mentioned this earlier, but I've been writing Servlets and JSPs for the past 5 years and I've learned quite a few things from this book. Add this book to your library today. The code for this book is available on O'

    --Vinny Carpenter

    Displaying reviews 1-5

    Back to top

    Buy 2 Get 1 Free Free Shipping Guarantee
    Buying Options
    Immediate Access - Go Digital what's this?
    Ebook:  $39.99
    Formats:  DAISY, ePub, Mobi, PDF
    Print & Ebook:  $54.99
    Print:  $49.99