Java Servlet & JSP Cookbook and over 2 million other books are available for Amazon Kindle . Learn more
FREE Delivery in the UK.
Only 1 left in stock (more on the way).
Dispatched from and sold by Amazon.
Gift-wrap available.
Java Servlet & JSP Co... has been added to your Basket
+ £2.80 UK delivery
Used: Very Good | Details
Condition: Used: Very Good
Comment: Former Library book. Great condition for a used book! Minimal wear. 100% Money Back Guarantee. Shipped to over one million happy customers. Your purchase benefits world literacy!
Have one to sell?
Flip to back Flip to front
Listen Playing... Paused   You're listening to a sample of the Audible audio edition.
Learn more
See this image

Java Servlet & JSP Cookbook Paperback – 31 Jan 2004

See all 3 formats and editions Hide other formats and editions
Amazon Price New from Used from
Kindle Edition
"Please retry"
"Please retry"
£18.83 £1.25
£33.50 FREE Delivery in the UK. Only 1 left in stock (more on the way). Dispatched from and sold by Amazon. Gift-wrap available.

Frequently Bought Together

Java Servlet & JSP Cookbook + JavaServer Pages
Price For Both: £63.49

Buy the selected items together

Product details

  • Paperback: 748 pages
  • Publisher: O'Reilly Media; 1 edition (31 Jan. 2004)
  • Language: English
  • ISBN-10: 0596005725
  • ISBN-13: 978-0596005726
  • Product Dimensions: 17.8 x 4.3 x 23.3 cm
  • Average Customer Review: 3.5 out of 5 stars  See all reviews (2 customer reviews)
  • Amazon Bestsellers Rank: 1,045,345 in Books (See Top 100 in Books)
  • See Complete Table of Contents

More About the Author

Over the course of a decades-long writing career, I've written on the environment, software, and fitness. Now fiction-"Barbarous Coasts" is the first novel I've published (literally, self-published). I think the natural world, ecology, and human fitness are deeply entwined. I like spending lots of time in the mountains-skiing, climbing, hiking, thinking.

My next novel, coming early this summer, takes place in the mountains.

Most of my time is spent with my family in Vermont and Massachusetts, USA.

Product Description

About the Author

Bruce W. Perry is an independent software developer and writer. Since 1996, he has developed web applications and databases for various non-profits, design and marketing firms, ad agencies, and digital-music specialists. Before working in the web field, Perry remained tethered to his portable and desktop Macs while writing environmental law books and newsletters. When not hacking or writing, he loves cycling and climbing mountains in the U.S. and Switzerland. He lives in the Newburyport, Massachusetts area with his wife Stacy LeBaron and daughter Rachel.

Excerpt. © Reprinted by permission. All rights reserved.

CHAPTER 17 - Embedding Multimedia in JSPs

17.0 Introduction
Most web sites include some type of multimedia and interactive programs, such as digital videos, digital audio files, Macromedia Flash movies, and Java applets. Therefore, Java web sites often integrate this type of content with servlets and JavaServer Pages (JSPs). This chapter explains the basics of embedding multimedia in Java web components. This process involves including the object and embed tags in your component’s HTML output.

A JSP is the preferred choice for combining multimedia with dynamic content, because you can make the tags that you use to embed the multimedia a part of the JSP’s HTML template text. However, Recipe 17.5 also shows how to include multimedia as part of a servlet’s output.

If the page containing the multimedia content does not have to include any other type of dynamic output, just use a static HTML page instead of executing JSPs and servlets. A static page typically requires fewer server resources to respond to HTML page requests.

17.1 Embedding an Applet in a JSP
Using jsp:plugin

You want to use the jsp:plugin standard action to execute a Java applet with the Java Plug-in software.

Use the jsp:plugin action positioned in the area of a JSP where you want the applet
to appear.

The JSP specification provides a standard action, jsp:plugin, which produces the object and embed tags that are designed to allow browsers to load a Java applet. The action will run the applet using Sun Microsystems’s Java Plug-in or initiate the download of the Plug-in if the user has not yet installed the Plug-in.

The Java Plug-in is designed to execute an applet using Sun Microsystems’s Java 2 Runtime Environment, rather than any Java runtime provided by the browser. The installation of the Java JRE or Software Development Kit automatically installs the Java Plug-in.

Use nested jsp:param elements to provide the applet with any necessary parameter and value pairs. The jsp:param elements must be nested within a single jsp:params element.

Inside This Book (Learn More)
Browse Sample Pages
Front Cover | Copyright | Table of Contents | Excerpt | Index | Back Cover
Search inside this book:

What Other Items Do Customers Buy After Viewing This Item?

Customer Reviews

3.5 out of 5 stars
5 star
4 star
3 star
2 star
1 star
See both customer reviews
Share your thoughts with other customers

Most Helpful Customer Reviews

16 of 16 people found the following review helpful By Mr. J. Hopkins on 6 Jan. 2005
Format: Paperback
I bought this as an intermediate Java programmer wanting to check my understanding and see if I was missing any tricks and move on a bit.
It covers a fairly broad area, and I did find parts of it useful but I was expecting more difficult problems to be addressed. Many examples I had already worked out for myself, such as login routines....
Also the three chapters of the book explains how to (1) write servlets, (3) name them and set up directives and (2) the setup of Tomcat and Web Logic. I wouldnt have expected a cook book to waste time telling you how to turn the oven on. Tomcat could have been dealt with in one page, telling you how to install it, connect to localhost and find the documentation on the start page.
If you are new to Java (with a little basic knowlege) this is a pretty good book. It doesnt waste time and does have code you will find useful.
If like me your looking to move from intermediate to advanced its a good overview, does allow you to check your understanding and consolodate your learning, but wont move you forward.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again
Format: Paperback Verified Purchase
Great book, filled with many useful examples.
Originally purchased for work to speed up understanding for a new dev project, more than made up for the price of the purchase.
Comment Was this review helpful to you? Yes No Sending feedback...
Thank you for your feedback. If this review is inappropriate, please let us know.
Sorry, we failed to record your vote. Please try again

Most Helpful Customer Reviews on (beta) 8 reviews
33 of 33 people found the following review helpful
Over 130 Hacks! 10 Feb. 2004
By W Boudville - Published on
Format: Paperback
The 'cookbook' in the title means that Perry emphasises what he considers to be many common tasks needed to be done by Java Servlets and JSPs, in a J2EE context. Similar in spirit to OReilly's other books like 'eBay Hacks' and 'google Hacks'. In fact, in the 26 chapters of Perry's book, there are on average over 5 tasks in each that he explains, which are akin to the hacks of the other books. Except here, he gives you over 130 hacks.
He assumes you know the basics of the subject. Certainly, the book does not claim to be a comprehensive listing of the subject's features. But if you satisfy this requirement, you can dive straight into any section of any chapter. Don't have to read this book linearly.
However, if you aren't using Tomcat or BEA WebLogic as containers, then the relevance of the book may, frankly, be more limited. Different containers have slightly different functionalities, and the examples he gives are very specific to those 2 containers. If you are in fact using another, perhaps you can use this book to provide design patterns and inspiration, but not actual code.
85 of 94 people found the following review helpful
Hampered by use of custom libraries 7 Sept. 2004
By Matthew J. Weaver - Published on
Format: Paperback
Being an O'Reilly fan it is hard for me to find fault with their no-nonsense approach to technical books, but there is one MAJOR issue I have with this book.

As a developer for a major corporation I cannot use custom libraries for my work, especially when the license ([...]) does not allow for commercial use. Where it would be helpful to see details on creating say, a multipart request class, Bruce Perry instead uses the com.oreilly.servlet.MultipartRequest class to hide much of the functionality (this is just one example).

This makes little or no sense. Developers in the real world need real examples. Hiding the implementation of such under the non-commercial license pretty much ruins much of the potential application of an otherwise well written book. If you buy this book realise that only some of it will actually be useful in the real world.
25 of 27 people found the following review helpful
Must-have book for any Servlet/JSP developer 5 Mar. 2004
By Vinny Carpenter - Published on
Format: Paperback
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 along with a nice little chapter on Ant. One of the most common question after people deploy 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.
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 dot com
12 of 12 people found the following review helpful
Very good bridge from theory to practical... 15 Mar. 2004
By Thomas Duff - Published on
Format: Paperback
Target Audience
Web developers who are looking for real-life examples of the use of servlets and JSP.
This is a companion-type book that goes beyond strictly reference material to the use of different servlet and JSP features, along with working examples of code to illustrate the concepts.
The book is divided multiple chapters that each cover a different technique or function:
Writing Servlets and JSPs; Deploying Servlets and JSPs; Naming Your Servlets; Using Apache Ant; Altering the Format of JSPs; Dynamically Including Content In Servlets and JSPs; Handling Web Form Data in Servlets and JSPs; Uploading Files; Handling Exceptions in Web Applications; Reading And Setting Cookies; Session Tracking; Integrating JavaScript with Servlets And JSPs; Sending Non-HTML Content; Logging Messages from Servlets and JSPs; Authenticating Clients; Binding, Accessing, and Removing Attributes in Web Applications; Embedding Multimedia in JSPs; Working With The Client Request; Filtering Request and Responses; Managing Email In Servlets and JSPs; Accessing Databases; Using Custom Tag Libraries; Using The JSTL; Internationalization; Using JNDI and Enterprise JavaBeans; Harvesting Web Information; Using the Google and Amazon Web APIs
I really like the O'Reilly Cookbook series. I read a lot as part of my ongoing study, and often it's easy to understand conceptually what is going on. But making the jump to practical solutions can be difficult at times. The Cookbook series gets plenty of use on my bookshelf as I do my day to day coding. And when it comes to servlet and JSP coding as I continue to learn more about Websphere Application Server, this book will surely become dog-eared like the rest of them. Bruce Perry has done a great job.
As with most Cookbook titles, each chapter in the Servlet And JSP Cookbook is made up of a number of Problem/Solution/Discussion groupings. This format proposes a coding problem, states the solution to solve it, and then devotes the necessary space to discuss the solution both with text and code. By using this format, you can think through a working solution and determine how to apply that technique to your own problem. Perry covers a wide range of problems that will help both the beginner and the experienced coder. For beginners, the solutions for setting cookies with servlets and JSPs may be just what you need to get started. Experienced people will find the internationalization and JNDI/Enterprise JavaBeans solutions useful. I appreciate the fact that coders of all experience levels can get something out of this book.
The only caveat I have on this book is that it is very focused on the Tomcat and WebLogic web application servers. If that's your platform of choice, you're going to get everything this book has to offer. For me, I'm partial to the WebSphere platform. While I will benefit from a lot of this book, there are chapters that will have no appeal to me, such as using the Ant package. I will also need to pay attention to the coding examples to make sure that the techniques are coded correctly for my platform of choice. Even with that warning, I would still highly recommend this book to all coders working in this area.
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.
10 of 11 people found the following review helpful
Precisely the book I've been dreaming of... 7 Oct. 2004
By Brock Seyler - Published on
Format: Paperback
This book is exactly what it claims to be: a general reference to hundreds of "everyday" situations Java Web developers face. Just as any cookbook, it doesn't go into the "deepest" details about every little thing, and it does give examples of ways to not reinvent the wheel. Some reviewers see this as worthy of only 1 star... This is only a 1 star book for readers who like to reinvent the wheel and waste time on unnecessary details... if you're like me and have deadlines to meet, you'll find what you need here quickly and efficiently.
Were these reviews helpful? Let us know