BUY THIS BOOK
Add to Cart

Print Book $44.95


Add to Cart

Print+PDF $58.44

Add to Cart

PDF $35.99

Safari Books Online

What is this?

Add to UK Cart

Print Book £31.95

What is this?

Looking to Reprint or License this content?

Java Servlet & JSP Cookbook

By Bruce W. Perry
January 2004
Pages: 746
Series: Cookbooks
ISBN 10: 0-596-00572-5 | ISBN 13: 9780596005726
starstarstarstarstar (Average of 4 Customer Reviews)

Buy 2 Get 1 Free Free ShippingGuarantee

Book description

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.
Full Description

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.

Browse within this book

Cover | Table of Contents | Colophon




Featured customer reviews

Write a Review


Thanks,  March 10 2008
Rating: StarStarStarStarStar
Submitted by rufik   [Respond | View]

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



need help,  August 12 2006
Rating: StarStarStarStarStar
Submitted by cougarwww   [Respond | View]

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


A Must Buy,  June 07 2005
Submitted by Anonymous Reader   [Respond | View]

i am considering to buy this book, and i have one question. Does this book have practice problems?

Read all reviews


Patchy,  August 24 2004
Submitted by Anonymous Reader   [Respond | View]

hello reader,

I included instructions on acquiring the JWSDP, because a lot of readers will not be exposed to the latest versions of the JSTL through Tomcat 5.x, because they are not using that Tomcat version yet (particularly when the book was published in Jan 2004). The JWSDP is a reference implementation that includes Tomcat and JSTL 1.1, so it is an easy option for downloading and getting acquainted with JSTL 1.1.

In addition, there are some examples later in Chapter 23 showing how to use the c:forEach tag with a java.util.Map, such as Example 23-8, pg.568, which uses c:forEach with a java.util.SortedMap; and recipe 23.13, which uses c:forEach with the "cookies" JSTL implicit object, a java.util.Map type. We should have referenced you from the c:forEach introduction to these examples later in the chapter. Example 16-8 on pg. 367 shows how to use c:set to place a new value into a java.util.Map object; again we should have forward referenced (or back referenced in this case!) from the JSTL chapter.
In general, it's important to include some recipes that might seem too basic for some readers, to assist newcomers.
Finally, thanks for the correction on the WEB-INF/classes path. I even use that path in the web application that provides the basis for the book. Aaaargh!

Bruce


Patchy,  August 20 2004
Submitted by Anonymous Reader   [Respond | View]

Another good example of where they could have sacrificed boilerplate to useful info: it devotes a whole page to how you go about downloading the Java WSDP, but then in the next recipe neglects to tell you that the <c:set> tag can be used to set properties of Maps and JavaBeans as well as scoped variables, but that you need different syntax to do it.



Patchy,  August 17 2004
Submitted by Anonymous Reader   [Respond | View]

Oh and I forgot - it even has at least one downright error - on p597 it states that you should save your l10n .properties files in WEB-INF - but (at least in Tomcat) they need to be in WEB-INF/classes. It took me a good 30 mins to sort out this one.


Patchy,  August 17 2004
Rating: StarStarStarStarStar
Submitted by Jez   [Respond | View]

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 <forEach> 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.



A Must Buy,  April 08 2004
Rating: StarStarStarStarStar
Submitted by Vinny_Carpenter   [Respond | View]

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'Reilly.com

--Vinny Carpenter
http://www.j2eegeek.com/blog/




Media reviews "I really like the O'Reilly Cookbook series...this book will surely become dog-eared like the rest of them. Bruce Perry has done a great job...This is definitely a title that will be useful to you as you learn more about servlet and JSP programming. It will give you the ideas you need to solve real business problems you'll encounter as a developer."
--Thomas Duff, Portland Domino/Notes User Group, March 2004


Read all reviews

See larger cover