![]() |
|
Published 2005-10-27 Printer-friendly version
There have been several corrections to the source to accommodate recent updates to the JDK and Tomcat 4 changes, including prefixing SecurityBean constants with the class rather than the object name, and a test for a null cookie array in ControllerServlet.doGet.
If you cannot connect to MySQL on the localhost, try granting access privileges to name@localhost.localdomain (rather than just name@localhost).
The latest source version is available for download.
The create.sql script in deweb.war has been updated, fixing a missing semicolon after the FLUSH PRIVILEGES statement and an incorrect Articles table definition.
There are several places in the book where IP addresses for the MySQL server are listed as 207.161.247.xx. You will not be able to connect to these servers. Instead, change the IP addresses (or use domain names) to refer to your own database server(s).
If you wish to look at the source code without installing Tomcat first, just download the WAR files and use the jar program or a zip/unzip utility to extract the files.
During the final stages of editing much of the source code for the book was moved to the hungryminds web application (which is available for download. Not all of the source listings and code references in the first edition reflect this change. In particular, there are places where an examples directory is referenced. In most cases you should replace examples hungryminds, as most of the sample source is located in the hungryminds web application. There are also several locations where the directory idg should be changed to hungryminds (paralleling the publisher's name change from IDG to Hungry Minds, which also happened during the book's final stages).
As well, some of the examples at the time of writing were being used in a root context, mapped to a local IP address like this:
<Host name="192.168.1.1" > <Context path="" docBase="webapps/hungryminds" /> </Host>
If you take the above approach, you can dispense with the hungryminds directory when referencing the various examples. The more likely scenario is the following, however (which is also the default if you dont' specifically map a context in server.xml):
<Context path="/hungryminds"
docBase="webapps/hungryminds"
debug="0"
reloadable="true" >
</Context>
In the latter approach you need to specify hungryminds in all of the URLs. The following corrections assume that this scenario.
| Reference | Correction |
| p. 62 | The form action in
the source listing should be <form action="/hungryminds/servlet/ch04.GetFormFields" method="GET"> |
| p. 63 | The GetPostTest.html file should be saved in the ch04 subdirectory, not the examples subdirectory. |
| p. 64 | You will find
GetFormFields.class in the hungryminds/WEB-INF/classes/ch04 directory
The form action should be |
| p. 65 | The form action
should be <form action="/hungryminds/servlet/ch04.GetFormFields" method="POST"> The URL for calling the servlet should be http://localhost:8080/hungryminds/servlet/ch04.GetFormFields |
| Reference | Correction |
| p. 79 | The url to call basic.jsp should be http://192.168.1.9:8080/hungryminds/ch05/basic.jsp |
| Reference | Correction |
| p. 106-107 | There are several
corrections to the code listing here. The choice String should not be
newed, and the equality operator should be replaced with the
String.choice() method inside a null test:choice = request.getParameter("choice");
if (choice != null) {
try {
if (choice.equals("book"))
//code to print the quote omitted
else if (choice.equals("flies"))
// rest of code omitted
|
| Reference | Correction |
| p. 195-197 | While you can recreate the SQL script in listing 11-1, you may want to instead refer to the deweb/WEB-INF/create.sql script in the deweb.war web application (available from the dowload page). This script contains the tables in the listing and several others. If you want to create these tables in a database other than deweb, edit the CREATE DATABASE, GRANT, and USE statements at the beginning of the script. |
| Reference | Correction |
| p. 247-248 | As with listing 11-1, you may want to instead refer to the deweb/WEB-INF/create.sql script in the deweb.war web application (available from the dowload page). This script contains the tables in the listing and several others. If you want to create these tables in a database other than deweb, edit the CREATE DATABASE, GRANT, and USE statements at the beginning of the script. |
| p. 250 ff | The ch15 classes described in the rest of the chapter have been superceded by the deweb web application (available from the dowload page). The IterateTag and IterateTEI classes are in the com.covecomm.deweb.taglib package, and the source files are in deweb/WEB-INF/classes/com/covecomm/deweb/taglib directory. |
| p. 252 | The web.xml file can be found in deweb/WEB-INF |
| p. 253 | The WebAppSetup servlet is in the com.covecomm.deweb.control package. |
| p. 253 | The Host param-value should be localhost or your database server's name or IP address, not 207.161.247.94, which you will not be able to access. |
| p. 256 | The package name for the HttpLinksCacheBean class should be com.covecomm.deweb.doc, and the source is in deweb/WEB-INF/classes/com/covecomm/deweb/doc |
| p. 261 | The ControllerServlet package is com.covecomm.deweb.control, not ch15. |
| Reference | Correction |
| All listings | All classes have
been moved from the ch15 package into the deweb packages.
Tag prefixes are now deweb: not ch15: - use the deweb application (and of course the deweb/WEB-INF/deweb.tld tag library descriptor and deweb/WEB-INF/web.xml) as the basis for your experimentation. The fully qualified class names in this chapter are: com.covecomm.deweb.doc.HttpLinkBean |
| Reference | Correction |
| All listings | As with Chapter 16, all code has now been moved to the deweb web application. |
| Reference | Correction |
| All listings | Same as Chapters 16 and 17. |
Copyright © 2005 by CoveComm Inc. All Rights Reserved.