Java Servlet Programming, Second Edition By Jason Hunter with William Crawford This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. (Please specify the printing date of your copy.) This page was last modified on August 2, 2007. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: {5} 6th line from bottom http://www.microsoft.com/workshop/server/default.asp should be: http://www.microsoft.com/asp/ (9) 1st paragraph; "Most Java-based application support servlets..." should read "Most Java-based application servers support servlets..." {19} 2nd paragraph, 6th line "an HttpSession class" should be replaced by "an HttpSession interface". {22} 2nd full paragraph; The text: "if the servlet were part of a package, it would need to be placed in server_root/webapps/ROOT/WEB-INF/package.name ..." should read: "if the servlet were part of a package, it would need to be placed in server_root/webapps/ROOT/WEB-INF/classes/package.name ..." i.e. the string classes should be between WEB-INF and package.name (32) IN PRINT: Second paragraph, third bullet item, second sentence; "...ending with that prefix." SHOULD BE: "...ending with that suffix." {44} 2nd paragraph from bottom; The reference to the web.xml deployment descriptor DTD points to the wrong appendix. It should be Appendix C, not F. Also title of Appendix is wrong. {62} Top of page in printFooter() method: The printFooter() method prints the ending BODY tag to out but does not print the ending HTML tag. The method should be: private void printFooter(PrintWriter out) throws ServletException { out.println(""); out.println(""); // this was omitted } (72) 2nd paragraph.; The third sentence begins with "Compared this to....", it should be "Compared to ..." without the "this". [99] The ServletRequest should be HttpServletRequest. The same change should be made to the sentence leading up to the example. (101) 3rd paragraph); The possible typo (between astrisks): "Example 4-16 shows ViewFile servlet that uses the getPathTranslated() and getMimeType() methods to return the file *is* given by the extra path information." The 2nd 'is' is confusing. Perhaps remove it and change the word given to described. (182) doGet() method Ex. 6-8 First try block closed too early; in the first "try" block, after "URL source = ServletUtils.getResource(....))" the try block is closed but the finally for the block ends at the end of the doGet method. The online examples and source do not have this error, just the printed example in the book. Correct Source code can be downloaded from Servlets.com (241) Figure 8-2. A Friendly login form; Based on Example 8-5 and the surrounding context, the URL in the browser should be "http://localhost:8080/loginpage.html" instead of "http://localhost:8080/login.html". [287] Near bottom after comment starting with "If we get here..."; connections.put(con, Boolean.FALSE); should be - connections.put(con, Boolean.TRUE); {323} in the snippet of code 10.6; I believe the 'InputStream' object should be closed before exiting the 'getDateUsingHttpObject()' method: ... in.close(); <-- HERE // Return the string representation of the Date return date.toString(); } (page 333), the getDateUsingSocketObject method lists... Socket socket = null; try { // Establish a socket connection with the servlet Socket socket = new Socket(getCodeBase().getHost(), getSocketPort()); It should be: Socket socket = null; try { // Establish a socket connection with the servlet socket = new Socket(getCodeBase().getHost(), getSocketPort()); {374} "req.getNamedDispatcher" should be "context.getNamedDispatcher" {422} 1st paragraph; The link shown for Tea, http://opensource.go.com no longer works. The new site for Tea is http://teatrove.sourceforge.net/ {483} Example 16-2: Lines 20 and 26 in the code (counting blank lines); The code should add the TD and TH objects to the TR object, not to the table itself. So the code should be: Line 20: row.addElement(new TH().addElement(rsmd.getColumnName(i))); Line 26: row.addElement(new TD().addElement(rs.getString(i))); If you don't add the TH and TDs to the row then your HTML is not well formed since your and s are not inside the element. {489} Example 16-9; The code should add the TD and TH objects to the TR object, not to the table itself. So the code should be: Line 29 (from top of pg 489): row.addElement(new TH().addElement(rsmd.getColumnName(i))); Line 11 (from top of pg 490): row.addElement(td); If you don't add the TH and TDs to the row then your HTML is not well formed since your and s are not inside the element. {522} The paragraph under errorPage section: "The servlet may retrieve the Throwable as the context attribute as javax.servlet.jsp.jspException." Should be: "The servlet may retrieve the Throwable as the request attribute as javax.servlet.jsp.jspException." {531} 1st code fragment; The code sample is: <%@ include file="pathFoFile" %> Should be: <%@ include file="pathToFile" %> (539) Last paragraph (point #4); This step is would not be required if the ... In the above statement, the "is" looks like a typo. It should be removed. {641} 2nd Paragraph, 2nd sentance This sentance does not belong to this description and should be removed