Java Servlet and JSP Cookbook

( 3 )

Overview

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

See more details below
Paperback (First Edition)
$33.97
BN.com price
(Save 32%)$49.99 List Price
Other sellers (Paperback)
  • All (33) from $1.99   
  • New (10) from $14.73   
  • Used (23) from $1.99   
Java Servlet & JSP Cookbook

Available on NOOK devices and apps  
  • NOOK Devices
  • Samsung Galaxy Tab 4 NOOK
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK for Web

Want a NOOK? Explore Now

NOOK Book (eBook)
$22.99
BN.com price
(Save 42%)$39.99 List Price

Overview

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.

Read More Show Less

Product Details

  • ISBN-13: 9780596005726
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 1/28/2004
  • Edition description: First Edition
  • Edition number: 1
  • Pages: 748
  • Product dimensions: 7.00 (w) x 9.20 (h) x 1.70 (d)

Meet the Author

Bruce W. Perry played college soccer in New York, then amidst a varied career in journalism and software engineering finished literally (ask his knees!) hundreds of road races and multisport events. He's since moved on to family life and recreational alpine hiking, skiing, and resistance training. He has also written two recent software books for O'Reilly Media. After an unguided youth, he now hangs out weightlifting in gyms again, and climbs with guides now, recently Piz Palu in the Swiss Alps, Mt. Whitney's Mountaineer's Route, and Mt. Rainier.

Read More Show Less

Table of Contents

Preface;
What's in the Book;
Audience;
Organization;
Conventions Used in This Book;
Using Code Examples;
Comments and Questions;
Acknowledgments;
Chapter 1: Writing Servlets and JSPs;
1.1 Introduction;
1.1 Writing a Servlet;
1.2 Writing a JSP;
1.3 Compiling a Servlet;
1.4 Packaging Servlets and JSPs;
1.5 Creating the Deployment Descriptor;
Chapter 2: Deploying Servlets and JSPs;
2.1 Introduction;
2.1 Deploying an Individual Servlet on Tomcat;
2.2 Using a Context Element in Tomcat'sserver.xml;
2.3 Deploying an Individual Servlet on WebLogic;
2.4 Deploying an Individual JSP on Tomcat;
2.5 Deploying an Individual JSP on WebLogic;
2.6 Deploying a Web Application on Tomcat;
2.7 Deploying a Web Application on WebLogic Using Ant;
2.8 Using the WebLogic Administration Console;
2.9 Using WebLogic Builder to Deploy a Web Application;
2.10 Using the weblogic.DeployerCommand-Line Tool;
Chapter 3: Naming Your Servlets;
3.1 Introduction;
3.1 Mapping a Servlet to a Name in web.xml;
3.2 Creating More Than One Mapping to a Servlet;
3.3 Creating a JSP-Type URL for a Servlet;
3.4 Mapping Static Content to a Servlet;
3.5 Invoking a Servlet Without a web.xml Mapping;
3.6 Mapping All Requests Within a Web Application to a Servlet;
3.7 Mapping Requests to a Controller and Preserving Servlet Mappings;
3.8 Creating Welcome Files for a Web Application;
3.9 Restricting Requests for Certain Servlets;
3.10 Giving Only the Controller Access to Certain Servlets;
Chapter 4: Using Apache Ant;
4.1 Introduction;
4.1 Obtaining and Setting Up Ant;
4.2 Using Ant Targets;
4.3 Including Tomcat JAR files in the Build File Classpath;
4.4 Compiling a Servlet with an Ant Build File;
4.5 Creating a WAR File with Ant;
4.6 Creating a JAR File with Ant;
4.7 Starting a Tomcat Application with Ant;
4.8 Stopping a Tomcat Application with Ant;
Chapter 5: Altering the Format of JSPs;
5.1 Introduction;
5.1 Precompiling a JSP in Tomcat;
5.2 Precompiling a JSP in WebLogic;
5.3 Precompiling JSPs with the Precompilation Protocol;
5.4 Mapping a JSP to Its Page Implementation Class;
5.5 Creating a JSP from Scratch as a JSP Document;
5.6 Generating an XML View from a JSP;
Chapter 6: Dynamically Including Content in Servlets and JSPs;
6.1 Introduction;
6.1 Including a Resource Each Time a Servlet Handles a Request;
6.2 Using an External Configuration to Include a Resource in a Servlet;
6.3 Including Resources Nested at Multiple Levels in a Servlet;
6.4 Including a Resource that Seldom Changes into a JSP;
6.5 Including Content in a JSP Each Time the JSP Handles a Request;
6.6 Using an External Configuration File to Include a Resource in a JSP;
6.7 Including an XML Fragment in a JSP Document;
6.8 Including Content from Outside a Context in a JSP;
Chapter 7: Handling Web Form Data in Servlets and JSPs;
7.1 Introduction;
7.1 Handling a POST HTTP Request in a Servlet;
7.2 Handling a POST HTTP Request in a JSP;
7.3 Setting the Properties of a JavaBean in a JSP;
7.4 Setting a Scoped Attribute in a JSP to the Value of a Form Parameter;
7.5 Posting Data from a Servlet;
7.6 Posting Data from a JSP;
7.7 Using a Servlet to Add a Parameter to a Query String;
7.8 Using a JSP to Add a Parameter to a Query String;
7.9 Using a Filter to Read Parameter Values;
Chapter 8: Uploading Files;
8.1 Introduction;
8.1 Preparing the HTML Page for File Uploads;
8.2 Using the com.oreilly.servlet Library;
8.3 Uploading One File at a Time;
8.4 Uploading Multiple Files;
8.5 Renaming Files;
8.6 Using a JSP to Handle a File Upload;
Chapter 9: Handling Exceptions in Web Applications;
9.1 Introduction;
9.1 Declaring Exception Handlers in web.xml;
9.2 Creating an Exception-Handling Servlet;
9.3 Sending an Error from a Servlet;
9.4 Sending an Error from a JSP;
9.5 Creating an Error-Handling JSP;
9.6 Declaring a Special Exception-Handling JSP for Other JSPs;
Chapter 10: Reading and Setting Cookies;
10.1 Introduction;
10.1 Setting a Cookie with a Servlet;
10.2 Creating an Array from All of the Request's Cookies;
10.3 Setting a Cookie with a JSP;
10.4 Reading Cookie Values with a Servlet;
10.5 Reading Cookie Values with a JSP;
10.6 Altering or Removing a Cookie That Has Already Been Set;
Chapter 11: Session Tracking;
11.1 Introduction;
11.1 Setting the Session Timeout in web.xml;
11.2 Setting the Session Timeout in All Tomcat Web Applications;
11.3 Setting the Session Timeout Programmatically;
11.4 Checking if a Session Exists in an HttpServletRequest;
11.5 Tracking Session Activity in Servlets;
11.6 Tracking Session Activity in JSPs;
11.7 Using URL Rewriting in a JSP;
11.8 Using URL Rewriting in a Servlet;
11.9 Using a Listener to Track the Session Lifecycle;
11.10 Using a Listener to Monitor Session Attributes;
11.11 Using a Filter to Monitor Session Attributes;
Chapter 12: Integrating JavaScript with Servlets and JSPs;
12.1 Introduction;
12.1 Including JavaScript Modules in a Servlet;
12.2 Including JavaScript Modules in a JSP;
12.3 Creating a New Window with JavaScript in a Servlet;
12.4 Creating a New Window with JavaScript in a JSP;
12.5 Using JavaScript to Validate Form Values in a Servlet;
12.6 Using JavaScript to Validate Form Values in a JSP;
Chapter 13: Sending Non-HTML Content;
13.1 Introduction;
13.1 Sending a PDF File;
13.2 Sending a Word Processing File;
13.3 Sending an XML file;
13.4 Sending an Audio File;
13.5 Viewing Internal Resources in a Servlet;
Chapter 14: Logging Messages from Servlets and JSPs;
14.1 Introduction;
14.1 Logging Without Log4j;
14.2 Setting Up Log4j;
14.3 Using a Logger Without a Configuration File;
14.4 Adding an Appender to the Root Logger;
14.5 Using a Pattern with a Logger's Appender;
14.6 Using log4j in a JSP;
14.7 Logging Messages Using a Servlet Context Event Listener;
14.8 Logging Messages Using a Session Event Listener;
Chapter 15: Authenticating Clients;
15.1 Introduction;
15.1 Creating Users and Passwords with Tomcat;
15.2 Setting Up SSL on Tomcat;
15.3 Using BASIC Authentication;
15.4 Using Form-Based Authentication;
15.5 Logging Out a User;
15.6 Using JAAS to Create a LoginModule;
15.7 Creating the JAAS Configuration File;
15.8 Using JAAS in a Servlet;
15.9 Using JAAS in a JSP;
Chapter 16: Binding, Accessing, and Removing Attributes in Web Applications;
16.1 Introduction;
16.1 Setting ServletContext Attributes in Servlets;
16.2 Setting ServletContext Attributes in JSPs;
16.3 Accessing or Removing ServletContext Attributes in Servlets;
16.4 Accessing or Removing ServletContext Attributes in JSPs;
16.5 Setting Session Attributes in Servlets;
16.6 Setting Session Attributes in JSPs;
16.7 Accessing or Removing Session Attributes in Servlets;
16.8 Accessing or Removing Session Attributes in JSPs;
16.9 Setting Request Attributes in Servlets;
16.10 Setting Request Attributes in JSPs;
16.11 Accessing or Removing Request Attributes in Servlets;
16.12 Accessing or Removing Request Attributes in JSPs;
Chapter 17: Embedding Multimedia in JSPs;
17.1 Introduction;
17.1 Embedding an Applet in a JSPUsing jsp:plugin;
17.2 Embedding an Applet in a JSP Using the HTML Converter;
17.3 Automatically Creating HTML Template for Including Flash Files;
17.4 Writing HTML Template to Embed a Flash File;
17.5 Embedding Flash in a Servlet;
17.6 Embedding a QuickTime Movie in a JSP;
17.7 Embedding an SVG File in a JSP;
17.8 Embedding a Background Soundtrack in a JSP;
Chapter 18: Working With the Client Request;
18.1 Introduction;
18.1 Examining HTTP Request Headers in a Servlet;
18.2 Examining HTTP Request Headers in a JSP;
18.3 Using a Filter to Alter Request Headers;
18.4 Automatically Refreshing a Servlet;
18.5 Automatically Refreshing a JSP;
18.6 Counting the Number of Web Application Requests;
Chapter 19: Filtering Requests and Responses;
19.1 Introduction;
19.1 Mapping a Filter to a Servlet;
19.2 Mapping a Filter to a JSP;
19.3 Mapping More Than One Filter to a Servlet;
19.4 Changing the Order in Which Filters are Applied to Servlets;
19.5 Configuring Initialization Parameters for a Filter;
19.6 Optionally Blocking a Request with a Filter;
19.7 Filtering the HTTP Response;
19.8 Using Filters with RequestDispatcher Objects;
19.9 Checking Form Parameters with a Filter;
19.10 Blocking IP Addresses with a Filter;
Chapter 20: Managing Email in Servlets and JSPs;
20.1 Introduction;
20.1 Placing the Email-Related Classes on your Classpath;
20.2 Sending Email from a Servlet;
20.3 Sending Email from a Servlet Using a JavaBean;
20.4 Accessing Email from a Servlet;
20.5 Accessing Email from a Servlet Using a JavaBean;
20.6 Handling Attachments from an Email Received in a Servlet;
20.7 Adding Attachments to an Email in a Servlet;
20.8 Reading a Received Email's Headers from a Servlet;
Chapter 21: Accessing Databases;
21.1 Introduction;
21.1 Accessing a Database from a Servlet Without DataSource;
21.2 Configuring a DataSource in Tomcat;
21.3 Using a DataSource in a Servlet with Tomcat;
21.4 Creating a DataSource on WebLogic;
21.5 Using a JNDI Lookup to get a DataSource from WebLogic;
21.6 Using a DataSource from WebLogic in a JSP;
21.7 Calling a Stored Procedure from a Servlet;
21.8 Calling a Stored Procedure from a JSP;
21.9 Converting a ResultSet to a Result Object;
21.10 Executing Several SQL Statements Within a Single Transaction;
21.11 Using Transactions with JSPs;
21.12 Finding Information about a ResultSet;
Chapter 22: Using Custom Tag Libraries;
22.1 Introduction;
22.1 Creating a Classic Tag Handler;
22.2 Creating a JSP 1.2 TLD for a Classic Tag Handler;
22.3 Creating a JSP 2.0 TLD for a Classic Tag Handler;
22.4 Packaging a Tag Library in a Web Application;
22.5 Packaging the Tag Library in a JAR File;
22.6 Using the Custom Tag in a JSP;
22.7 Handling Exceptions in a Custom Tag Class;
22.8 Creating a Simple Tag Handler;
22.9 Creating a TLD for a Simple Tag Handler;
22.10 Using a Simple Tag Handler in a JSP;
22.11 Creating a JSP Tag File;
22.12 Packaging the JSP Tag File in a Web Application;
22.13 Packaging the JSP Tag File in a JAR;
22.14 Using a Custom Tag Associated with a Tag File;
22.15 Adding a Listener Class to a Tag Library;
Chapter 23: Using the JSTL;
23.1 Introduction;
23.1 Downloading the JSTL 1.0 and Using the JSTL Tags in JSPs;
23.2 Downloading the Java Web Services Developer Pack;
23.3 Using the Core JSTL Tags;
23.4 Using the XML Core JSTL Tags;
23.5 Using the XML Transform Tags;
23.6 Using the Formatting JSTL Tags;
23.7 Using A SQL JSTL Tag with a DataSource Configuration;
23.8 Using A SQL JSTL Tag Without a DataSource Configuration;
23.9 Accessing Scoped Variables with the EL;
23.10 Accessing Request Parameters with the EL;
23.11 Using the EL to Access Request Headers;
23.12 Using the EL to Access One Request Header;
23.13 Accessing Cookies with the EL;
23.14 Using the EL to Access JavaBean Properties;
23.15 Using JSTL Functions;
Chapter 24: Internationalization;
24.1 Introduction;
24.1 Detecting the Client Locale in a Servlet;
24.2 Detecting the Client's Locales in a JSP;
24.3 Creating a ResourceBundle as a Properties File;
24.4 Creating a ResourceBundle as a Java Class;
24.5 Using the ResourceBundle in a Servlet;
24.6 Using the ResourceBundle in a JSP;
24.7 Formatting Dates in a Servlet;
24.8 Formatting Dates in a JSP;
24.9 Formatting Currencies in a Servlet;
24.10 Formatting Currencies in a JSP;
24.11 Formatting Percentages in a Servlet;
24.12 Formatting Percentages in a JSP;
24.13 Setting the Localization Context in the Deployment Descriptor;
Chapter 25: Using JNDI and Enterprise JavaBeans;
25.1 Introduction;
25.1 Configuring a JNDI Object in Tomcat;
25.2 Accessing the Tomcat JNDI Resource from a Servlet;
25.3 Accessing the Tomcat JNDI Resource from a JSP;
25.4 Configuring a JNDI Resource in WebLogic;
25.5 Viewing the JNDI Tree in WebLogic;
25.6 Accessing the WebLogic JNDI Resource from a Servlet;
25.7 Accessing the WebLogic JNDI Resource from a JSP;
25.8 Accessing an EJB Using the WebLogic JNDI Tree;
Chapter 26: Harvesting Web Information;
26.1 Introduction;
26.1 Parsing an HTML Page Using thejavax.swing.text Subpackages;
26.2 Using a Servlet to Harvest Web Data;
26.3 Creating a JavaBean as a Web Page Parser;
26.4 Using the Web Page Parsing JavaBean in a Servlet;
26.5 Using the Web Page Parsing JavaBean in a JSP;
Chapter 27: Using the Google and Amazon Web APIs;
27.1 Introduction;
27.1 Getting Set Up with Google's Web API;
27.2 Creating a JavaBean to Connect with Google;
27.3 Using a Servlet to Connect with Google;
27.4 Using a JSP to Connect with Google;
27.5 Getting Set Up with Amazon's Web Services API;
27.6 Creating a JavaBean to Connect with Amazon;
27.7 Using a Servlet to Connect with Amazon;
27.8 Using a JSP to Connect with Amazon;
Colophon;

Read More Show Less

Customer Reviews

Average Rating 3.5
( 3 )
Rating Distribution

5 Star

(0)

4 Star

(2)

3 Star

(1)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com 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 & Noble.com 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 & Noble.com 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 BN.com 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

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com 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 BN.com. 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
  • Posted March 17, 2009

    more from this reviewer

    Good information, but lacks background information.

    I had a hard time finding a good book that was current on this subject.
    This book does seem to have thorough coverage of the material.
    I felt that the examples where too focused. For each example it is assumed that all the parts not listed are already completed and correct, and that you did those parts exactly like the author would have. Not a good assumption.

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

    Posted December 11, 2005

    Java Servlet & JSP Cookbook

    Very useful and well written. I would recommend this book to someone interested in its topic. An adequate reference on this topic.The presentation of the book is neat. It covers real-world problems, and provides concise, practical solutions to each. This book targets Java web developers of all levels. Less experienced web developers who prefer to learn by doing, this book is a great store for cooked recipes. I really liked the section on custom tag libraries and JSTL. Tag Libraries are a great way to avoid scriptlet code and it is one of the best practices

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

    Posted February 10, 2004

    Over 130 Hacks!

    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.

    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)