Errata

Java Servlet & JSP Cookbook

Errata for Java Servlet & JSP Cookbook

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 72
Example 3-17, Line 18

Text that is written on the page: <url-pattern>/weatherurl-pattern>

This, in order for the XML file to be valid, should read: <url-pattern>/weather</url-
pattern>

Anonymous   
Printed
Page 72
Example 3-17, Line 18

Text that is written on the page: <url-pattern>/weatherurl-pattern>

This, in order for the XML file to be valid, should read: <url-pattern>/weather</url-
pattern>

Anonymous    Apr 01, 2008
Other Digital Version
72
Example 3-17, Line 18

Text that is written on the page: <url-pattern>/weatherurl-pattern>

This, in order for the XML file to be valid, should read: <url-pattern>/weather</url-
pattern>

Anonymous    Jul 01, 2008
Printed
Page 81
Example 4-3

<classpath refid="servlet-classpath "/>
does not function as a valid reference. This should
read
<classpath refid="servlet-classpath"/>

Anonymous   
Printed
Page 81
Example 4-3

<classpath refid="servlet-classpath "/>
does not function as a valid reference. This should
read
<classpath refid="servlet-classpath"/>

Anonymous    Apr 01, 2008
Other Digital Version
81
Example 4-3

<classpath refid="servlet-classpath "/>
does not function as a valid reference. This should
read
<classpath refid="servlet-classpath"/>

Anonymous    Jul 01, 2008
Printed
Page 89

http://ant.apache.org/ant/manual/CoreTasks/war.html

NOW READS:
http://ant.apache.org/manual/CoreTasks/war.html

Anonymous    Jan 01, 2006
Printed
Page 108
line -2

An extra comma after "Hello" HAS BEEN DELETED.

Anonymous    Jan 01, 2006
Printed
Page 133
under "See Also"

The reference to Recipe 6.9 NOW READS Recipe 6.8

Anonymous    Jan 01, 2006
Printed
Page 137
under "See Also"

The reference to Recipe 6.9 NOW READS Recipe 6.8

Anonymous    Jan 01, 2006
Printed
Page 142
line -18

"bottom of Example 6-18" NOW READS "bottom of Example 6-19"

Anonymous    Jan 01, 2006
Printed
Page 143
line -5

"tag-lib" NOW READS "taglib".

Anonymous    Jan 01, 2006
Printed
Page 146
line 9

"ans exception" NOW READS "an exception".

Anonymous    Jan 01, 2006
Printed
Page 164
line 16

"I'l use this space" NOW READS "I'll use this space"

Anonymous    Jan 01, 2006
Printed
Page 179
line 13 of example 8-3

public void init( )
webTempPath = getServletContext( ).getRealPath("/") + "data";
}

NOW READS:
public void init( ) {
webTempPath = getServletContext( ).getRealPath("/") + "data";
}

Anonymous    Jan 01, 2006
Printed
Page 190
line 5

change "jspservlet/cookbook" to "jspservletcookbook" to match the package name

Anonymous   
Printed
Page 190
line 5

change "jspservlet/cookbook" to "jspservletcookbook" to match the package name

Anonymous    Apr 01, 2008
Other Digital Version
190
line 5

change "jspservlet/cookbook" to "jspservletcookbook" to match the package name

Anonymous    Jul 01, 2008
Printed
Page 236
line 2

... getSession(false) method and the method returns "false",...
should be
... getSession(false) method and the method returns "null",...

Anonymous   
Printed
Page 236
line 2

... getSession(false) method and the method returns "false",...
should be
... getSession(false) method and the method returns "null",...

Anonymous    Apr 01, 2008
Other Digital Version
236
line 2

... getSession(false) method and the method returns "false",...
should be
... getSession(false) method and the method returns "null",...

Anonymous    Jul 01, 2008
Printed
Page 243
Figure 11-5

The right half of the last line of text in this figure is trash. The date/time is repeated.

Anonymous   
Printed
Page 312
line 6

if realPath==null (see line 2) then "null" is prepended to "WEB-INF/classes/".

Anonymous   
Printed
Page 318
line 9. Cut/pasted from (312) - same problem.

The code could include:

if (realPath == null)
realPath = "";

Other options are throwing a JSPException if the realPath value is
null, or providing an alternative method of configuring log4j if the
code cannot formulate an absolute file path to the configuration file.

Anonymous   
Printed
Page 332
lines -8, -14

change "loginError.html" to "loginError.jsp".
This page is defined at the bottom of page 334.

Anonymous   
Printed
Page 332
lines -8, -14

change "loginError.html" to "loginError.jsp".
This page is defined at the bottom of page 334.

Anonymous    Apr 01, 2008
Other Digital Version
332
lines -8, -14

change "loginError.html" to "loginError.jsp".
This page is defined at the bottom of page 334.

Anonymous    Jul 01, 2008
Printed
Page 340
SQL statements for authenticating a user

The example uses two separate sql statements for authenticating a user. The first verfies
that the username exists and the second verfies that the password exists, but there
is nothing there to make sure that the correct password goes with a specific
username. By doing it this way you are letting any valid user authenticate with any
stored password!

You can fix this by changing sqlpass to
"SELECT * FROM athlete WHERE passwrd='"+pass+"' AND name='"+name+"'";

Anonymous   
Printed
Page 340
SQL statements for authenticating a user

The example uses two separate sql statements for authenticating a user. The first verfies
that the username exists and the second verfies that the password exists, but there
is nothing there to make sure that the correct password goes with a specific
username. By doing it this way you are letting any valid user authenticate with any
stored password!

You can fix this by changing sqlpass to
"SELECT * FROM athlete WHERE passwrd='"+pass+"' AND name='"+name+"'";

Anonymous    Apr 01, 2008
Other Digital Version
340
SQL statements for authenticating a user

The example uses two separate sql statements for authenticating a user. The first verfies
that the username exists and the second verfies that the password exists, but there
is nothing there to make sure that the correct password goes with a specific
username. By doing it this way you are letting any valid user authenticate with any
stored password!

You can fix this by changing sqlpass to
"SELECT * FROM athlete WHERE passwrd='"+pass+"' AND name='"+name+"'";

Anonymous    Jul 01, 2008
Printed
Page 507
Bottom third of Example 21-14

The code phrase "witch..." should be "switch..."
as in the Java language "switch" statement.

Anonymous   
Printed
Page 507
Bottom third of Example 21-14

The code phrase "witch..." should be "switch..."
as in the Java language "switch" statement.

Anonymous    Apr 01, 2008
Other Digital Version
507
Bottom third of Example 21-14

The code phrase "witch..." should be "switch..."
as in the Java language "switch" statement.

Anonymous    Jul 01, 2008
Printed
Page 544
In Example 22-9

The taglib uri value "http://java.sun.com/jstl/core"

NOW READS:
"http://java.sun.com/jsp/jstl/core"

Anonymous    Jan 01, 2006
Printed
Page 557
line 10

change "greater than zero" to "not zero"

Anonymous   
Printed
Page 557
line -13

change "collection" to "array"

Anonymous   
Printed
Page 557
line 10

change "greater than zero" to "not zero"

Anonymous    Apr 01, 2008
Printed
Page 557
line -13

change "collection" to "array"

Anonymous    Apr 01, 2008
Other Digital Version
557
line 10

change "greater than zero" to "not zero"

Anonymous    Jul 01, 2008
Other Digital Version
557
line -13

change "collection" to "array"

Anonymous    Jul 01, 2008
Printed
Page 568
line -4

This forEach line should be on page 569 line 4.5 so the headers don't get repeated on every iteration of
the loop

Anonymous   
Printed
Page 568
line -4

This forEach line should be on page 569 line 4.5 so the headers don't get repeated on every iteration of
the loop

Anonymous    Apr 01, 2008
Other Digital Version
568
line -4

This forEach line should be on page 569 line 4.5 so the headers don't get repeated on every iteration of
the loop

Anonymous    Jul 01, 2008
Printed
Page 571
line -14 Same problem as on page (568).

The <c:forEach...> line should be placed after the HTML <th> tags

Anonymous   
Printed
Page 571
line -14 Same problem as on page (568).

The <c:forEach...> line should be placed after the HTML <th> tags

Anonymous    Apr 01, 2008
Other Digital Version
571
line -14 Same problem as on page (568).

The <c:forEach...> line should be placed after the HTML <th> tags

Anonymous    Jul 01, 2008
Printed
Page 596
final paragraph

In the solution, the author specifies that ResourceBundle properties files should be
stored beneath "WEB-INF".

This reference NOW READS "WEB-INF/classes"

Anonymous    Jan 01, 2006
Printed
Page 637
first paragraph

A reference to Recipe 25.11 should refer to Example 25-11.

"The filter in Recipe 25.11 then set..."
should be:
"The filter in Examples 25-11 then set..."

Anonymous   
Printed
Page 637
first paragraph

A reference to Recipe 25.11 should refer to Example 25-11.

"The filter in Recipe 25.11 then set..."
should be:
"The filter in Examples 25-11 then set..."

Anonymous    Apr 01, 2008
Other Digital Version
637
first paragraph

A reference to Recipe 25.11 should refer to Example 25-11.

"The filter in Recipe 25.11 then set..."
should be:
"The filter in Examples 25-11 then set..."

Anonymous    Jul 01, 2008
Printed
Page 672
lines 21

There is no "none" option which appears in Figure 27-1.
The servlet code should include an "<option selected>none</option>" before the other option tags in the
String

Anonymous   
Printed
Page 672
lines 21

There is no "none" option which appears in Figure 27-1.
The servlet code should include an "<option selected>none</option>" before the other option tags in the
String

Anonymous    Apr 01, 2008
Other Digital Version
672
lines 21

There is no "none" option which appears in Figure 27-1.
The servlet code should include an "<option selected>none</option>" before the other option tags in the
String

Anonymous    Jul 01, 2008
Printed
Page 677
line 1 change

"can have values of mac," to "can have values of none, mac,"

Anonymous   
Printed
Page 677
line 1 change

"can have values of mac," to "can have values of none, mac,"

Anonymous    Apr 01, 2008
Other Digital Version
677
line 1 change

"can have values of mac," to "can have values of none, mac,"

Anonymous    Jul 01, 2008
Printed
Page 689
line 12

the "</body></html>" on this line is repeated again at lines -5.
The first "</body></html>" should be omitted.

Anonymous   
Printed
Page 689
line 12

the "</body></html>" on this line is repeated again at lines -5.
The first "</body></html>" should be omitted.

Anonymous    Apr 01, 2008
Other Digital Version
689
line 12

the "</body></html>" on this line is repeated again at lines -5.
The first "</body></html>" should be omitted.

Anonymous    Jul 01, 2008