Java Servlet Programming

Errata for Java Servlet Programming

Submit your own errata for this product.


The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color Key: Serious Technical Mistake Minor Technical Mistake Language or formatting error Typo Question Note Update



Version Location Description Submitted By Date Submitted Date Corrected
Printed
Page xii
paragraph at top of page

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Dec 01, 1998
Printed
Page xii
paragraph at top of page

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Jan 01, 1999
Printed
Page 7
In the fourth paragraph, last line

JDSK should be: JSDK

Anonymous   
Printed
Page 7
2nd paragraph under "Support for Servlets"

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Dec 01, 1998
Printed
Page 7
2nd paragraph under "Support for Servlets"

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Jan 01, 1999
Printed
Page 10
first bulleted item on page, first sentence starts

"Sun's JavaServer Toolkit and JavaServer Engine, ..." Changed to read: "Sun's JavaServer Engine, ..." Also, at the end of the second sentence, changed "Java Server Toolkit." to "JavaServer Engine." Finally, changed the URL in the last sentence to: http://java.sun.com/products/javaserverengine/

Anonymous    Dec 01, 1998
Printed
Page 10
first bulleted item on page, first sentence starts

"Sun's JavaServer Toolkit and JavaServer Engine, ..." Changed to read: "Sun's JavaServer Engine, ..." Also, at the end of the second sentence, changed "Java Server Toolkit." to "JavaServer Engine." Finally, changed the URL in the last sentence to: http://java.sun.com/products/javaserverengine/

Anonymous    Jan 01, 1999
Printed
Page 20
first bulleted list item

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Dec 01, 1998
Printed
Page 20
first bulleted list item

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Jan 01, 1999
Printed
Page 20
In the first paragraph after Example 2-1, the first sentence

used to read: "This servlet extends the HttpServlet class and overloads the doGet() method inherited from it." Now reads: "This servlet extends the HttpServlet class and overrides the doGet() method inherited from it." The word "overloads" has been replaced with "overrides". Also, the word "receives" in the next sentence is now in roman font, rather than constant width.

Anonymous    Jan 01, 2000
Printed
Page 21

The second full paragraph used to read: "...or, for educational use, http://www.sun.com/ products-n-solutions/edu/java." The phrase was removed from the fifth sentence.

Anonymous    Mar 01, 2000
Printed
Page 27
A footnote was added to the end of the first

paragraph under "Server-Side Includes". It reads: "Note that support for SSI has been disapproved since this book originally went to press, so you may not want to spend much time on this material."

Anonymous    Jul 01, 2000
Printed
Page 30
In the footnote, "for a servlets" should be changed to "for a servlet"

Anonymous   
Printed
Page 30

The footnote at the bottom of the page, 2nd line, used to read: ...generate output for a servlets used ... It now reads: ...generate output for a servlet used ...

Anonymous    Jul 01, 1999
Printed
Page 34

The first sentence of second paragraph should be changed to read: "Inside doGet(), the servlet checks the content type of the data, sets its output type, and then fetches its print writer." doGet should be in constant width font.

Anonymous   
Printed
Page 39

In Example 2-7, the last two lines of code used to read: out.println("</H1>" out.println("</BODY></HTML>" Both lines were missing a right parenthesis and semicolon. They now read: out.println("</H1>"); out.println("</BODY></HTML>");

Anonymous    Jan 01, 2000
Printed
Page 40
Figure 2-12

The figure needs to be corrected: "<HEAD>" should be "</HEAD>", "<BODY>" should be "</BODY>", and "<HTML>" should be "</HTML>".

Anonymous   
Printed
Page 43

The URL is in the footnote used to read: "http://java.sun.com/bean/" It now reads: "http://java.sun.com/beans/"

Anonymous    Jul 01, 2000
Printed
Page 45

In example 2-11, the second line used to read: CLASS="HelloBean" It now reads: TYPE="HelloBean

Anonymous    Apr 01, 1999
Printed
Page 52
In the first sentence of the paragraph under the first block used to

read: "using the servlet class" It now reads: "using the servlet instance".

Anonymous    Jul 01, 2000
Printed
Page 71
In the fifth sentence under the second full bullet

The word "last" was changed to "previous"

Anonymous    Jul 01, 2000
Printed
Page 81

The first sentence of the last paragraph used to read: "How does this involves servlets?" It now reads: "How does this involve servlets?"

Anonymous    Jul 01, 2000
Printed
Page 85
Near the bottom is the code fragment

String[] words = req.getParameterValues("word"); if (words != null) { for (int i = 0; i < words.length; i++) { String definition = getDefinition(words[i]); out.println(word + ": " + definition); // BUG out.println("<HR>"); } } the line with //BUG has been changed from "word" to "words[i]".

Anonymous    Jul 01, 1999
Printed
Page 94
3rd paragraph in "Determining What Was Requested"

", extra path information, and query string." now reads ", and extra path information."

Anonymous    Dec 01, 1998
Printed
Page 94
3rd paragraph in "Determining What Was Requested"

", extra path information, and query string." now reads ", and extra path information."

Anonymous    Jan 01, 1999
Printed
Page 95
In the footnote, changed

http://ds.internic.net/rfc/rfc1630.txt To: http://www.ietf.org/rfc/rfc1630.txt

Anonymous    Jul 01, 1999
Printed
Page 97

Example 4-11 used to read: while (keys.hasMoreElements() && elements.hasMoreElements()) { bufferedWriter.write(keys.nextElement() + " " + elements.nextElement() + " "); } It now reads: while (keys.hasMoreElements() && elements.hasMoreElements()) { String name = (String) keys.nextElement(); int[] val = (int[]) elements.nextElement(); bufferedWriter.write(name + " " + val[0] + " "); }

Anonymous    Mar 01, 2000
Printed
Page 100

In line twelve, the text should read: ...usually "HTTP/1.0" or "HTTP/1.1" In other words, cut the three v's and replace them with straight quotes. "HTTP/1.0" and "HTTP/1.1" should be in constant width font.

Anonymous   
Printed
Page 104
Example 4-15

The line of code that checks for the "Content-Length" header field reads: if ("Content-Length").equalsIgnoreCase(header)) There is a ')' before the dot. The line should read: if ("Content-Length".equalsIgnoreCase(header)) 1 2 21

Anonymous   
Printed
Page 104
8th line from the bottom, changed

... stream, you should to use getReader() to: ... stream, you should use getReader()

Anonymous    Jul 01, 1999
Printed
Page 107
2nd paragraph in "Receiving files using the input stream," changed

http://ds.internic.net/rfc/rfc1867.txt To: http://www.ietf.org/rfc/rfc1867.txt

Anonymous    Jul 01, 1999
Printed
Page 109
The last sentence of the second main paragraph used to

read: "getParameterNamess" The second "s" has been deleted. It now reads: "getParameterNames "

Anonymous    Jan 01, 2000
Printed
Page 110
Line 13 from bottom, changed

... request, a directory to saves files to, ... to ... request, a directory to save files to, ...

Anonymous    Jul 01, 1999
Printed
Page 135
Example 5-5, in the middle of the page

Removed the following line of code: PrintWriter out = res.getWriter();

Anonymous    Dec 01, 1998
Printed
Page 135
Example 5-5, in the middle of the page

Removed the following line of code: PrintWriter out = res.getWriter();

Anonymous    Jan 01, 1999
Printed
Page 136
Example 5-5

In the last line of code on the page: // Send the page to the response s output stream there was a missing '. It now reads "response's".

Anonymous    Dec 01, 1998
Printed
Page 136
Example 5-5

In the last line of code on the page: // Send the page to the response s output stream there was a missing '. It now reads "response's".

Anonymous    Jan 01, 1999
Printed
Page 139
Example 5-6, near the bottom of the page

Removed the following line of code: PrintWriter out = res.getWriter();

Anonymous    Dec 01, 1998
Printed
Page 139
Example 5-6, near the bottom of the page

Removed the following line of code: PrintWriter out = res.getWriter();

Anonymous    Jan 01, 1999
Printed
Page 154
Second (middle) code snippet

the line of code that sends the "SC_INTERNAL_SERVER_ERROR" reads: res.sendError(res.SC._INTERNAL_SERVER_ERROR); This line contains a dot after "SC". It should read: res.sendError(res.SC_INTERNAL_SERVER_ERROR); (without the dot)

Anonymous   
Printed
Page 158
In the second line of last paragraph

PrinWriter should read: PrintWriter

Anonymous   
Printed
Page 189

The code used to read: // Go with GZIP res.setHeader("Content-Encoding", "x-gzip"); It now reads: // Go with GZIP res.setHeader("Content-Encoding", "gzip");

Anonymous    Mar 01, 2000
Printed
Page 189
The phrase:

"Netscape Navigator 3 and 4 on Unix and Microsoft Internet Explorer 4 on" was removed from the bottom of page 188.

Anonymous    Jul 01, 2000
Printed
Page 191
3rd paragraph under "Server Push"

Changed last sentence to read: "Note, however, that server push is not yet supported by Microsoft Internet Explorer, and extended use..."

Anonymous    Dec 01, 1998
Printed
Page 191
3rd paragraph under "Server Push"

Changed last sentence to read: "Note, however, that server push is not yet supported by Microsoft Internet Explorer, and extended use..."

Anonymous    Jan 01, 1999
Printed
Page 197
The last line before the sample code in the "Hidden Form

Fields" section used to read: "You include hidden form files with HTML like this:" It now reads: "You include hidden form fields with HTML like this:"

Anonymous    Jan 01, 2000
Printed
Page 202
End of 2nd paragraph of "Persistent Cookies," changed

http://ds.internic.net/rfc/rfc2109.txt To: http://www.ietf.org/rfc/rfc2109.txt

Anonymous    Jul 01, 1999
Printed
Page 214

The 2nd to last line the function call used to read: "isRequestedSessionIdValue()" Changed to: "isRequestedSessionIdValid()"

Anonymous    Apr 01, 1999
Printed
Page 221
The paragraph that starts with:

A client wants "and it also want" should read: "and it also wants"

Anonymous   
Printed
Page 223
The first line after the heading "Retrieving Authentication

Information" used to read: "A server"" It now reads: "A servlet"

Anonymous    Jan 01, 2000
Printed
Page 225
In the paragraph before example 8-2, changed

http://ds.internic.net/rfc/rfc1521.txt To: http://www.ietf.org/rfc/rfc1521.txt

Anonymous    Jul 01, 1999
Printed
Page 226
The Example 8-2 code that generates the SC_UNAUTHORIZED code

used to fail on some servers where the implementation of sendError() is such that it doesn't allow the following WWW-Authenticate header to be set. The fix is to call setHeader() before sendError(). Lines 7 and 8 of Example 8-2 have been transposed.

Anonymous    Jan 01, 2000
Printed
Page 231
In the middle of Example 8-5, the following chuck of code

// Try redirecting the client to the page he first tried to access try { String target = (String) session.getValue("login.target"); if (target != null) res.sendRedirect(target); return; Was changed to: if (target != null) { res.sendRedirect(target); return; }

Anonymous    Jul 01, 2000
Printed
Page 232
Fourth paragraph, first line

Browser misspelled as "brower" in the 3/00 printing of this book.

Anonymous   
Printed
Page 232-233
Starting with the paragraph that starts "Public

key encryption schemes have been around...", removed that paragraph and the three that followed it and replaced them with the following five paragraphs: ----- Public key encryption schemes have been around for several years and are quite well developed. Most are based on the patented RSA algorithm developed by Ron Rivest, Adi Shamir, and Leonard Adelman. RSA uses very large prime numbers to generate a pair of asymmetric keys (i.e., each key can decode messages encoded with the other). Individual keys come in varying lengths, usually expressed in terms of the number of bits that make up the key. 1024- or 2048-bit keys are adequate for secure RSA communications. Because keys are so large, it is not practical for a user to type one into her web browser for each request. Instead, keys are stored on disk in the form of digital certificates. Digital certificates can be generated by software like Phil Zimmerman's PGP package, or they can be issued by a third party. The certificate files themselves can be loaded by most security-aware applications, such as servers, browsers, and email software. Public key cryptography solves the confidentiality problem because the communication is encrypted. It also solves the integrity problem: Will knows that the message he received was not tampered with since it decodes properly. So far, though, it does not provide any authentication. Will has no idea whether Jason actually sent the message. This is where digital signatures come into play. Because public and private keys are asymmetric, Jason can first use his private key to encode a message and then use Will's public key to encode it again. When Will gets the message, he decodes it first with his private key, and then with Jason's public key. Because only Jason can encode messages with his private key--messages that can be decoded only with his public key--Will knows that the message was truly sent by Jason. This is different from simpler symmetric key systems, where a single key is used for encoding and decoding. While asymmetric keys have the significant advantage of allowing secure communication without ever requiring a secure channel, they have the disadvantage of requiring much more computational muscle. As a compromise, many encryption systems use asymmetric public and private keys to identify each other and then confidentially exchange a separate symmetric key for encrypting the actual exchange. The symmetric key is usually based on DES (Data Encryption Standard). U.S. government restrictions currently limit symmetric key size to 56 bits (about 72 quadrillion possible keys). Messages encrypted with a 56-bit key are difficult to decode, but by no means impossible--large networks have been used to decode such messages within a matter of days. With the United States, however, many systems use 128-bit DES keys (about 3.40282 x 10^38 possible keys). Because there is no known way to decode a DES-encrypted message short of brute-force trial and error, messages sent using large keys are very, very secure.

Anonymous    Jul 01, 1999
Printed
Page 234
In the second paragraph, last line of the 3/00 printing

The URL: http://www.ietf.org/ietf-tls should be: http://www.ietf.org/rfc/rfc2246.txt

Anonymous   
Printed
Page 234
End of 1st paragraph of "Secure Sockets Layer (SSL)," changed

http://www.consensus.com/ietf-tls To: http://www.ietf.org/rfc/rfc2246.txt

Anonymous    Jul 01, 1999
Printed
Page 234
5th item in list: changed "asymmetric" to "symmetric" twice

in this list item.

Anonymous    Jul 01, 1999
Printed
Page 238
1st paragraph after itemized list: in "None of these

approaches works very well" changed "works" to "work"

Anonymous    Jul 01, 1999
Printed
Page 239
Last paragraph before "Fine-grained control," changed "can be

signed using digital certificates." to "can be digitally signed."

Anonymous    Jul 01, 1999
Printed
Page 244
In the line reads "The most compelling reason for putting a middle

tier between a client and our ultimate date source is...". I believe that the reference to "date" should really be "data".

Anonymous   
Printed
Page 245
In output code block, "Janet" should be changed to "Jane".

Anonymous   
Printed
Page 251

The text used to read: "thin:dbhost" It now reads: "thin:@dbhost"

Anonymous    Mar 01, 2000
Printed
Page 275
A short footnote was added to the last sentence before Example 9-9.

The text of the footnote reads: "Note that the quality of binary stream support in database systems and JDBC drivers can vary widely. JDBC 2.0 drivers include improved handling of BLOB type objects, but implementation is still inconsistent."

Anonymous    Jul 01, 2000
Printed
Page 321
In the following lines of code

// doPost() accepts a new message and broadcasts it to all // the currently listening HTTP and socket clients. the second line should be changed to read: // the currently listening HTTP, socket, and RMI clients.

Anonymous   
Printed
Page 336
Example 10-21

Changed the following line: out.println("<PARAM NAME=user VALUE=">" + user + """); To: out.println("<PARAM NAME=user VALUE="" + user + "">");

Anonymous    Dec 01, 1998
Printed
Page 336
Example 10-21

Changed the following line: out.println("<PARAM NAME=user VALUE=">" + user + """); To: out.println("<PARAM NAME=user VALUE="" + user + "">");

Anonymous    Jan 01, 1999
Printed
Page 338
4th block of body text

The last sentence of the paragraph that ends "Servlet API. 2.0." now ends: "Servlet API."

Anonymous    Dec 01, 1998
Printed
Page 338
4th block of body text

The last sentence of the paragraph that ends "Servlet API. 2.0." now ends: "Servlet API."

Anonymous    Jan 01, 1999
Printed
Page 372
In the footnote, changed

http://ds.internic.net/rfc/rfc2278.txt To: http://www.ietf.org/rfc/rfc2278.txt

Anonymous    Jul 01, 1999
Printed
Page 376
1st paragraph of "UCS-2 and UTF-8," changed

http://ds.internic.net/rfc/rfc2279.txt To: http://www.ietf.org/rfc/rfc2279.txt

Anonymous    Jul 01, 1999
Printed
Page 377

1.1 used to read: Chinese, Korean, Russian, and Hebrew. Now reads: Chinese, Korean, and Russian.

Anonymous    Jul 01, 1999
Printed
Page 389
In the footnote, changed

http://ds.internic.net/rfc/rfc2070.txt To: http://www.ietf.org/rfc/rfc2070.txt

Anonymous    Jul 01, 1999
Printed
Page 402
In the 5th list item, changed

http://ds.internic.net/rfc/rfc822.txt To: http://www.ietf.org/rfc/rfc822.txt

Anonymous    Jul 01, 1999
Printed
Page 416
second paragraph under "Use a Standard Debugger"

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Dec 01, 1998
Printed
Page 416
second paragraph under "Use a Standard Debugger"

Changed the URL for the JSDK from: http://jserv.java.sun.com To: http://java.sun.com/products/servlet/

Anonymous    Jan 01, 1999
Printed
Page 422
The line of body text after Example 13-10,

"HTTPClient" Has been changed to: "HttpClient"

Anonymous    Apr 01, 1999
Printed
Page 422
The second bulleted list item

"server_root" is now in Courier-Italic (twice).

Anonymous    Apr 01, 1999
Printed
Page 442
In the "Description," changed

http://ds.internic.net/rfc/rfc2045.txt To: http://www.ietf.org/rfc/rfc2045.txt

Anonymous    Jul 01, 1999
Printed
Page 454
In the description for "doPut()" changed

http://ds.internic.net/rfc/rfc2068.txt To: http://www.ietf.org/rfc/rfc2068.txt

Anonymous    Jul 01, 1999
Printed
Page 465
The second heading on this page was changed from

"getLastAccessTime()" to "getLastAccessedTime()"

Anonymous    Jul 01, 2000
Printed
Page 470
In the description for getRequestUrl(), changed

", extra path information, and query string." to ", and extra path information."

Anonymous    Apr 01, 1999
Printed
Page 472
In the paragraph before table C-2 changed

http://ds.internic.net/rfc/rfc2068.txt To: http://www.ietf.org/rfc/rfc2068.txt

Anonymous    Jul 01, 1999
Printed
Page 472

The text in Appendix C used to read: "Table C-2 lists the HTTP status code constants defined by the HttpServletRequest interface..." It now reads: "Table C-2 lists the HTTP status code constants defined by the HttpServletResponse interface..."

Anonymous    Mar 01, 2000
Printed
Page 484
In Appendix E, the charsets for Chinese were reversed.

Simplified/Mainland is now GB2312, and Traditional/Taiwan is Big5.

Anonymous    Apr 01, 1999