Errata

Head First Servlets and JSP

Errata for Head First Servlets and JSP

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 81
Compiling the servlet

Correction to previous post:

On page 81 - Under the section Compiling the servlet the javac command line reads:

javac -classpath /Users/bert/Applications2/tomcat/common/lib/servlet-api.jar:classes:. -d classes src/com/example/web/BeerSelect.java

- this is correct if you are using UNIX!

However if you are using WINDOWS it should be:

javac -classpath \Users\bert\Applications2\tomcat\common\lib\servlet-api.jar;classes;. -d classes src\com\example\web\BeerSelect.java

Note from the Author or Editor:
Here we did add a note about Window used of semicolon delimiter in the 2nd Edition

Anonymous  Jun 18, 2009 
Printed
Page 344
last line of first paragraph under 7.1

implicit variable is cookie not cookies.

Note from the Author or Editor:
Correct

thuy nguyen  Apr 25, 2009 
Printed
Page xxvi
2nd bullet point

http://jakarta.apache.org/site/bin/index.cgi
SHOULD BE
http://jakarta.apache.org/site/binindex.cgi

Anonymous   
Printed
Page 6
bottom of page

(FYI: HTTP stands for HyperText Transport Protocol.)
should read
(FYI: HTTP stands for HyperText Transfer Protocol.)

Anonymous   
Printed
Page 15
Request line description

There is a discrepancy between the request line description in the middle of the page:
GET /select/selectBeerTaste.jsp
and in the "cloud callout" of the web browser at the bottom left of the page:
/select/selectBeerTaste.html
it should say:
/select/selectBeerTaste.jsp

Anonymous   
Printed
Page 21
2nd para - last sentence

The last sentence reads...

And even if it did, the POP3 server doesn't known anything....
it should be:
And even if it did, the POP3 server doesn't know anything....

Anonymous   
Printed
Page 26
1st paragraph - line 3

"exist before the request). and the ..."
should be
"exist before the request) and the ..."

Anonymous   
Printed
Page 30
the first line of web.xml

the first line of the web.xml file should be:
<?xml version="1.0" encoding="ISO-8859-1"?>

Anonymous   
Printed
Page 30
Step 3 - within the xml code for the DD

the third and fourth lines of xml read:

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
web-app_2_4.xsd"

This should be combined into one line, and a forward slash
should be inserted between the "j2ee" and the "web-app_2_4.xsd":

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

Anonymous   
Printed
Page 35
2nd bullet point

"... server gives back and HTTP response..."
should be:
"... server gives back an HTTP response..."

Anonymous   
Printed
Page 48
second paragraph to the last on the bottom

This is the what the client...
should be:
This is what the client...

Anonymous   
Printed
Page 58
First bullet point, last sentence

The text ends with
"so that you can concentrate of your own business logic".
it should be:
"so that you can concentrate on your own business logic".

Anonymous   
Printed
Page 58
3rd bullet point

The 3rd bullet point reads...
"A typical servlet is a class that extends HttpServletRequest"
should be:
"A typical servlet is a class that extends HttpServlet"

Anonymous   
Printed
Page 62

The 4th hand-written note "Gets the response from the container"
should read "Container generates the HTTP response stream from
the data in the response object" in the column marked "Container"

Anonymous   
Printed
Page 65
1st paragraph

"it incorporates other specifcations,..."
should be
"it incorporates other specifications,..."

Anonymous   
Printed
Page 71
Figure edit (per author)

In the top figure, labeled "Web Server," move the form.html file into the Container box.

Anonymous   
Printed
Page 77
2rd paragraph

and save it in your deployment environment under ....
should be
and save it in your development environment under ....

Anonymous   
Printed
Page 78
handwritten comment

...to the URL of the page its on.
should be:
...to the URL of the page it's on.

Anonymous   
Printed
Page 82
2nd paragraph

- Its directory structure should be /WEB-INF/classes/com/model
should have been
- Its directory structure should be /WEB-INF/classes/com/example/model

Anonymous   
Printed
Page 84
Addition of new code

The code for servlet version three on page 89 shows the following line as commented
out:
// out.println("<br>Got beer color " + c);

However, that line never appeared in the servlet version two code and should be added
(uncommented out and in bold) just above the following line on page 84:
BeerExpert be = new BeerExpert();

AUTHOR:
This is how I would reorganize these two code examples in a
future printing of the book.

First, on pg 84 move all of the code that (a) retrieves the
'color' parameter and (b) retrieve the results of the beer
search from the BeerExpert to the top of the doPost method.
Put the code to (a) set content type, (b) retrieve the Writer,
and (c) generate the response at the bottom of the doPost
method.

Second, on pg 89, reproduce the code structure from above,
but now comment out the bottom half which is being replaced
by the code to (a) set the 'styles' attribute, (b) create the
RequestDispatcher, and (c) forward to the view ReqDisp.

Anonymous   
Printed
Page 84
code example

The line "import java.util.*;" is not in bold even though it was not used in the previous servlet. this caused me two semantic errors when compiling because I did not add it at first.

Note from the Author or Editor:
OK

O'Reilly: make the sixth line of code "import java.util.*" bold.

Anonymous   
Printed
Page 90
first sentence following "Deploying and testing the web app"

"redploy"
should be:
"redeploy"

Anonymous   
Printed
Page 90
Last picture at bottom of page

try: Jack's Pale Ale
should read:
try: Jail Pale Ale

Anonymous   
Printed
Page 94
Coverage notes, 4th paragraph

"because the questions requires additional knowledge"
Should read:
"because the questions require additional knowledge"

Anonymous   
Printed
Page 100
Thought bubble at top left.

The final sentence says:

"So each time my doGet() or doPost() runs, it's in a separate method"

SHOULD READ

"So each time my doGet() or doPost() runs, it's in a separate thread."

Anonymous   
Printed
Page 106
ServletResponse interface

ServletResponse Interface shown has two setContentType() methods.
One of them should be getContentType()

Anonymous   
Printed
Page 106
ServletRequest interface

The line:
"getParameter()"
should be:
"getParameter(String)"

Anonymous   
Printed
Page 114
the answer to the "Sharpen your pencil" exercise

"The HTTP 1.1 spec declares GET, HEAD, and PUT as idempotent, even
though you CAN write a non-idemptotent doGet() method

should be:
"The HTTP 1.1 spec declares GET, HEAD, and PUT as idempotent, even
though you CAN write a non-idempotent doGet() method

the term "non-idemptotent" should read "non-idempotent"

Anonymous   
Printed
Page 114,116
Answer to Sharpen your pencil at bottom of page 114

"POST is considered idempotent by the HTTP 1.1 spec."
should be:
"POST is not considered idempotent by the HTTP 1.1 spec."

Anonymous   
Printed
Page 118
last paragraph (prefixed with "A:")

The "...if this request doesn't need to do post things..." wording is confusing given
the question is in regards to supporting *both* GET and POST.

Suggesting rewording: "A: Developers who want to support both methods usually put
logic in doGet(), and then have the doPost() implementation delegate to that doGet():"

Anonymous   
Printed
Page 123
2nd paragraph

The Input stream from request.getInputStream() will only
contain the body, not the header

Anonymous   
Printed
Page 132
Last Paragraph

Information at the bottom of the page labeled 'fiy' should be 'FYI'

Anonymous   
Printed
Page 136
3 changes on this page

Third hand-written note from the top should read:
The forward slash at the beginning means "relative to the root of the web container."

The last paragraph (and code) should read:
The Container builds the complete URL relative to the web container itself, instead
of relative to the original URL of the request. So the new URL will be:
http://www.wickedlysmart.com/foo/stuff.html

Fourth hand-written note from the top should read: See... the
"myApp/cool" part of the path isn't here this time.

Anonymous   
Printed
Page 142
question 4

A. response.setHeader(CONTENT-LENGTH, "numBytes");
B. response.setHeader("CONTENT-LENGTH", "numBytes");
should be:
A. response.setHeader(CONTENT-LENGTH, "1024");
B. response.setHeader("CONTENT-LENGTH", "1024");

Anonymous   
Printed
Page 154
TestInitParams source code

The source code for the TestInitParams servlet is missing an import.
Add:
import java.util.*;

Without the import the code won't compile because the Enumeration class is used.

Anonymous   
Printed
Page 154
the first line of web.xml

the first line of the web.xml file should be:
<?xml version="1.0" encoding="ISO-8859-1"?>

Anonymous   
Printed
Page 158
in the deployment descriptor section

<servlet-name>
BeerParamTests
<servlet-name>

it should be like this:

<servlet-name>
BeerParamTests
</servlet-name>

Anonymous   
Printed
Page 162
ServletContext interface

"setAttribute(String)"
should read:
"setAttribute(String, Object)"

Anonymous   
Printed
Page 177
Last line

URL pattern mapped to this the servlet: ListenTest.do
should read:
URL pattern mapped to the servlet: ListenTest.do

Anonymous   
Printed
Page 182
"Scenario" column, 5th row of grid

"will stored " should be "will be stored "

Anonymous   
Printed
Page 186
Grid 4th line 3rd column

There's no such method getInitParameter(String name) for javax.servlet.ServletRequest,
javax.servlet.HttpServletRequestWrapper, javax.servlet.http.HttpServletRequest,
javax.servlet.http.HttpServletRequestWrapper.

The correct is method getInitParameter(String name) for Application/ServletContext,Servlet,GenericServlet,HttpServlet and
getParameter(String name) for all classes/interfaces down the ServletRequest interface hierarchy (that is, extends or implements ServletRequest interface).

Since your differing Attributes and Parameters, I suggest indeed a third category: not Attributes, not Initialization Parameters, but Parameters (even better: "Arguments") related to the underlying protocol's request...

Note from the Author or Editor:
Not sure if this was fixed in the previous re-print, but if not...

The 4th row / 3rd column cell should have this text:
ServletContext.getInitParameter
ServletConfig.getInitParameter
ServletRequest.getParameter

Anonymous   
Printed
Page 189
top right paragraph

enumeration getAttributeNames()
should be:
Enumeration getAttributeNames()

Anonymous   
Printed
Page 189
ServletRequest interface box

ServletRequest interface box shows method name of getContextType(), where it should be getContentType().

Anonymous   
Printed
Page 189
HttpSession interface Column

In the list of methods for HttpSession Interface, the
setMaxInactiveInterval is shown without arguments.
setMaxInactiveInterval() should instead be written as
setMaxInactiveInterval(int interval)

Anonymous   
Printed
Page 199
2nd paragraph

'Are they are safe?'
should be:
'Are they safe?'

Anonymous   
Printed
Page 200
7th line of code

out.println("test context attributes<br>");
should be:
out.println("test session attributes<br>");

Anonymous   
Printed
Page 206
second column 5th row

Lifecycle event related to ServletRequest:
Method:
SessionDestroyed() should be requestDestroyed()

Anonymous   
Printed
Page 211, 217
1st paragraph

Which statements about listeners defined in the javax.servlet package are true?
should be:
"Which statements about listeners are true?"

Anonymous   
Printed
Page 213
Q 12 - item D

ServletRequest
should be:
HttpServletRequest

Anonymous   
Printed
Page 213
Question 12, answer E

In the last option (E) of question 12, the test states: 'The servlet to which a
request is forwarded may access the original query string by calling
getAttribute("javax.servlet.forward.query_string") on the' This statement is not
finished on the next line or the next page.

"ServletRequest" should be added to the last sentence of option E.

Anonymous   
Printed
Page 215
Answer to question 1

Option C should also be checked.

[214 + 220] Q 13;
this option is worded poorly. I would rephrase it as:
"If the servlet implements javax.servlet.SingleThreadModel,
the container may use one instance for each simultaneous
request."

Anonymous   
Printed
Page 215
Question 1

When I call the getOutputStream method on the response object and use the RequestDispatcher to perform a forward I get and IllegalStateException even if I do not write to or flush the output stream. For this reason I think choice D is also correct.

Note from the Author or Editor:
OK

O'Reilly: check option D

Anonymous   
Printed
Page 219
Q12 Answer D

Answers D and E are checked, but only E should be.
getQueryString() returns the dispatcher request path's query string, not the original query string.

Anonymous   
Printed
Page 231
2nd handwritten paragraph from the top starting with "(This method..." - 2nd

sentence starting wih "Now, there's still...";
"Now, there's still not guarantee the client will ACCEPT the cookie..."
should read:
"Now, there's still no guarantee the client will ACCEPT the cookie..."

Anonymous   
Printed
Page 235
diagram of HTTP response

the closing angle bracket for the anchor tag 'a href="http://wick.."' is missing

Anonymous   
Printed
Page 238
point 4 on the Bullet Poins

out.println("<a href="" +
response.encodeURL("/BeerTest.do"));

should be read:

out.println("<a href="" +
response.encodeURL("/BeerTest.do") +
"">Click Me</a>");

Anonymous   
Printed
Page 242
second column, fifth row

the parenthetical expression reads:
(for example, after the client does a shopping check-out or logs).
it should be
(for example, after the client does a shopping check-out or logs out)

Anonymous   
Printed
Page 245
Example 2

delete the line:
String foo = (String) session.getAttribute("foo");

out.println("Foo: " + foo);
should read:
out.println("Foo: " + session.getAttribute("foo"));

Anonymous   
Printed
Page 251
source code

There should be a

if (cookies!=null) {
}

after

Cookie[] cookies = request.getCookies();

Anonymous   
Printed
Page 254
Standout titled "You do NOT configure session binding listeners in the DD!

Standout reads:

"You do NOT configure session binding listeners in the DD! ... But this is NOT true
for the other session related listeners on the previous page. HttpSessionListener,
HttpSessionAttributeListener, and HttpSessionActivationListener must be registered
in the DD, since they're related to the session itself, rather than an individual
attribute placed in the session."

Should read:

""You do NOT configure session binding listeners OR SESSION ACTIVATION LISTENERS in
the DD! ... But this is NOT true for the other session related listeners on the
previous page. HttpSessionListener and HttpSessionAttributeListener must be
registered in the DD, since they're related to the session itself, rather than an
individual attribute placed in the session."

Anonymous   
Printed
Page 258
Serialization box at bottom of page

"...can also choose to implement a readObject() method, called by the VM whenever an
object is serialized, and a writeObject() method, called when an object is deserialized."

Should read:

"...can also choose to implement a writeObject() method called by the VM whenever an
object is serialized, and a readObject() method, called when an object is deserialized."

Anonymous   
Printed
Page 261
Bang box

The Bang! box on pg 261 is erroneous and should be dropped altogther.

Anonymous   
Printed
Page 262
2nd column, 4th row

HttpSessionAtrributeListener should be HttpSessionAttributeListener

Anonymous   
Printed
Page 265 and 272
Question 1

public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws IOException, ServletException {
// request.getSession().setAttribute("key", "value");
// request.getHttpSession().setAttribute("key", "value");
// ((HttpSession)request.getSession()).setAttribute("key", "value");
// ((HttpSession)request.getHttpSession()).setAttribute("key", "value");
}
}
Should be:

public class MyServlet extends HttpServlet {
public void doGet(HttpServletRequest req,
HttpServletResponse res)
throws IOException, ServletException {
// req.getSession().setAttribute("key", "value");
// req.getHttpSession().setAttribute("key", "value");
// ((HttpSession)req.getSession()).setAttribute("key", "value");
// ((HttpSession)req.getHttpSession()).setAttribute("key", "value");
}
}

change "request" to "req" to make it consistent!

Anonymous   
Printed
Page 274
Q7, Answer C

Answer C left off a vital part of the sentence when it was copied from the Servlet specification.
The Servlet specification says:

'Any object bound into a session is available to any other servlet that belongs to
the same ServletContext and handles a request identified as being a part of the same
session.'

Answer C leaves off the final part of the sentence: 'and handles a request identified
as being a part of the same session.' Without this answer C is not correct.

Anonymous   
Printed
Page 276
Question 12, Option C

Rewrite item C as: "When a session is moved from one JVM to another,
objects within the session that implement HttpSessionActivationListener
will be notified."

Anonymous   
Printed
Page 287
black box at bottom

AS IS:
<%= becauseThisIsAnArgumentToWrite() %>

SHOULD BE:
<%= becauseThisIsAnArgumentToPrint() %>

WHY THIS IS IMPORTANT:
There is also an error on page 343, which gets out.print() and out.write() mixed up.
Combined, these two errors confuse this point: JSP expressions become out.print() in
the _jspService() method and plain old template text becomes out.write() in the _jspService() method.

Anonymous   
Printed
Page 288
6th 'sharpen your pencil' question

<%= newString[3]) %>
should be:
<%= newString[3] %>

Anonymous   
Printed
Page 288
7th 'sharpen your pencil' question

<% = 42*20; %>
should be:
<% = 42*20 %>

Anonymous   
Printed
Page 293
in both of the code snippets,

... extends HttpServlet {

is misleading, the snippets should have continued to use the same pseudo-code as the snippet on page 291,
... extends SomeSpecialHttpServlet {

Anonymous   
Printed
Page 296
Implicti Object table

based on JSP 2.0 specification implicit variable exception is of type
java.lang.Throwable and not javax.servlet.jsp.JspException

JSP specification page 78 table JSP.1-7 Implicit Objects Available in Error Pages

Anonymous   
Printed
Page 297
Heading

This should be labelled a "Be the Container" exercise.

(In order to be consistent with text on page 300 where
the answer to p. 297 appears.

Anonymous   
Printed
Page 307
2nd Paragraph

Yes, you CAN get servlet init parameters from a servlet....
should read:
Yes, you CAN get servlet init parameters from a JSP...

Anonymous   
Printed
Page 308
The DD at the top part of the page

This DD does not work to allow the JSP to obtain the servlet init params.
The proper DD for this is:

<servlet>
<servlet-name>MyTestInit</servlet-name>
<jsp-file>/TestInit.jsp</jsp-file>
<init-param>
<param-name>email</param-name>
<param-value>wecare@wickedlysmart.com</param-value>
</init-param>
</servlet>

<servlet-mapping>
<servlet-name>MyTestInit</servlet-name>
<url-pattern>/TestInit.jsp</url-pattern>
</servlet-mapping>

Anonymous   
Printed
Page 322
Exercise no. 2.

"...OR place a checkmark in the ignored column if scripting will be treated like other template text."
should be:
"...OR place a checkmark in the error column if scripting will cause a translation error."

And change the "ignored" column title to "error".

(323 *and* 326) code magnets;
The code magnet should read
<jsp:include page="foo.html"/>
*not*
<jsp:include file="foo.html"/>

Anonymous   
Printed
Page 325
Exercise 2

change the "ignored" column title to "error".

Anonymous   
Printed
Page 327
3rd handwritten note

AS IS:
Expressions turn into write() statements in the service method.

SHOULD BE:
Expressions turn into out.print() statements in the service method.

Anonymous   
Printed
Page 343
3rd handwritten note

AS IS:
(Remember: scripting expressions are ALWAYS the argument to the out.write() method.)
SHOULD BE:
(Remember: scripting expressions are ALWAYS the argument to the out.print() method.)

Anonymous   
Printed
Page 353
Has this result title

Has this result
java.lang.InstantiationError: foo.Person

should be

Has this result
java.lang.InstantiationException: foo.Person

Anonymous   
Printed
Page 368
Paragraph under Using the dot(.) operator to access...title

The first variable is either ..., and the thing to the right of the dot is either a
map value(if the first variable is a map) ...

should be

The first variable is either..., and the thing to the right of the dot is either a
map key(if the first variable is a map) ...

Anonymous   
Printed
Page 372
Under title In a Servlet

says: favoriteFood.add("chai ice chream");
possible change: favoriteFood.add("chai ice cream");

Anonymous   
Printed
Page 386
above the line divider

${cookie.userName.valu} should be
${cookie.userName.value}

Anonymous   
Printed
Page 391
2nd paragraph (first A: block)

(a JSP supposed to be ...
should read
(a JSP is supposed to be ...

Anonymous   
Printed
Page 393
3rd item of "What prints for each of these?"

${requestScope[integer] ne 4 and 6 le num || false}
should read:
${requestScope["integer"] ne 4 and 6 le num || false}

Anonymous   
Printed
Page 399
First hand-written comment on top left

Says "This is the same as it was on the previous page..."
should say:
"This is the HTML content that we want on every page in our webapp."

Anonymous   
Printed
Page 400
1st paragraph

The <jsp:include> standard action appears to do the same thing as the include standard action.
should be:
The <jsp:include> standard action appears to do the same thing as the include directive.

Anonymous   
Printed
Page 404
The bottom diagram

in the diagram, the translated file name is Contact_jsp.java and the compiled file name is Contact_jsp.class
it should be Header_jsp.java and Header_jsp.class

Anonymous   
Printed
Page 405
In the top left BANG! box

In the sentence "To help you remember, the include directive <% include
file="foo.jsp"> is used only at translation time (as with all directives)."

It should read "To help you remember, the include directive <%@ include
file="foo.jsp"%> is used only at translation time (as with all directives)."

Anonymous   
Printed
Page 405
last sentence in bottom-right comment

Sentence should end "but that's more obvious with the
include directive.", not "page directive."

Anonymous   
Printed
Page 407
whole page

As the .jspf convention is not supported by default in Tomcat, the following mapping
needs to be added to the application's web.xml for the example to work correctly:

<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>*.jspf</url-pattern>
</servlet-mapping>

Anonymous   
Printed
Page 407
section 1 and section 2

Section 2 Contact.jsp;
<%@ include file="Header.jsp" %>
should be
<%@ include file="Header.jspf" %>

Anonymous   
Printed
Page 407
Section 3 The Footer file

The heading for section 3:
3 The Footer file ("Footer.jsp")
should be:
3 The Footer file ("Footer.html")

Anonymous   
Printed
Page 416
Be the Container Answers

The third example will not work for the same reason that the first example doesn't
work, because the attribute is at Request Scope, and the default scope is Page scope.
The handwritten comment for bullet #3 should be the same as for bullet #1.

Anonymous   
Printed
Page 420, 428
Question 6, option F

"${list[list['listIdx']]}"
should read:
"${list[list[listIdx]]}"

Anonymous   
Printed
Page 432
Question 17, Option C

option C is invalid and should not be checked.

Anonymous   
Printed
Page 434
Installing JSTL 1.1

The instructions indicate just jstl.jar file is required to run JSTL in Tomcat. You
also need standard.jar from the webapps/jsp-examples/WEB-INF/lib/ directory.

Anonymous   
Printed
Page 446
Bottom "Bang!" box.

... "target" attribute in the tag seems like it should work like "id" in the <jsp:setProperty>.
should be:
... "target" attribute in the tag seems like it should work like "id" in the <jsp:useBean>.

Anonymous   
Printed
Page 447
Answer to second q&a

Answer talks about using 'scope' attribute for c:set for
'var' or 'target'. Scope attribute is only meaningful for
'var'. Answer needs to be rewritten to remove any reference
to the 'target' attribute.

Anonymous   
Printed
Page 448
2nd handwritten comment

The scope is optional, and like always - page is the default scope.
should be:
The scope is optional, and when not specified the attribute is removed from all scopes.

Anonymous   
Printed
Page 452
first section

The JSP with the <jsp:include>
last line </body></html
should be </body></html>

Anonymous   
Printed
Page 453
Bullet item 1

The title of the bullet should be "The JSP with the <c:import>"

Anonymous   
Printed
Page 465
The box of 'The "Core" library, last item

<c:forEachToken>
should be:
<c:forTokens>.

Anonymous   
Printed
Page 467
1st paragraph

..., the DD below describes ...
should be
..., the TLD below describes ...

Anonymous   
Printed
Page 471
example 2 "Scripting expressions"

the closing single-quote is in the wrong place

<mine:advice user='<%= request.getAttribute("username")' %> />
should be:
<mine:advice user='<%= request.getAttribute("username") %>' />

Anonymous   
Printed
Page 480
Change to "${foo}" rather than "{userName}"

Anonymous   
Printed
Page 484
Code snippet, line 12

Change BeerStyles[] to BeerStyle[]

Anonymous   
Printed
Page 499
1st paragraph, first sentence

the sentence "the Container searches for tag files in four
locations" needs a period at the end.

Anonymous   
Printed
Page 507
BE the Container

The 2nd sentence in the "BE the Container" paragraph should read
"Assume that the tag handler prints the body of tag."

Anonymous   
Printed
Page 513
Sharpen your pencil, First sentence

Says "What is the result if the thingsDontWork test is false?"
should be:
"What is the result if the thingsDontWork test is True?"

Anonymous   
Printed
Page 520, 527, 532
TagSupport Class in the class diagram

return type of doAfterBody() should be "int" instead of "void"

Anonymous   
Printed
Page 527
Sharpen your pencil text

Try to mplement...
should read:
Try to implement...

Anonymous   
Printed
Page 537
First paragraph

There are two instances of <my:Menu> and one <my:MenuItem>. The code example below
the text uses tag <mine:Menu> and <mine:MenuItem>.
The instances of "<my:" should be changed to "<mine:".

Anonymous   
Printed
Page 537
3rd paragraph

Nested tags are used in several places in the JSTL; the <c:choose) tag..
should read:
Nested tags are used in several places in the JSTL; the <c:choose> tag..

Anonymous   
Printed
Page 544
Second to last paragraph

"The Container walks the tag nesting hieararchy until..."
should read:
"The Container walks the tag nesting hierarchy until..."

Anonymous   
Printed
Page 548
answer #2

<%@ tag body-content="tagdependent" %>
should be
<%@ tag body-content="empty" %>

Anonymous   
Printed
Page 549
question 1

first "to" is a typo

Anonymous   
Printed
Page 550
question 3

Option C is invalid.
Unfortunately, that leaves us with a mock question that doesn't have a valid answer.

Anonymous   
Printed
Page 555
Question 13, Option E

The code on Option E should be:
String p = (String) pageContext.getRequest().getAttribute("param");

Anonymous   
Printed
Page 557
question 17

Both tags are declared to be non-empty in the TLD.
should read:
Both tags are declared to be non-empty and non-tag dependent in the TLD.

Anonymous   
Printed
Page 558
Question 21, 1st line

"Given a web app sturcutre:"
should read:
"Given a web app structure:"

Anonymous   
Printed
Page 560
Question 4, Handwritten Comments for Option A

"-Option A is invalid because the doTag method dies return a value".
should read:
"...doTag method does not return a value".

Anonymous   
Printed
Page 563
Answer on question 9, written comment on option D

The written remark at option D belongs to option D of the answer
on question 8 and not question 9.
The comment for question 9 should be:
"-Option D is invalid because it is not a valid return code."

Anonymous   
Printed
Page 565
Question 13

Option E cannot be correct because it assigns the return value of
ServletRequest.getAttribute (an Object) to a String without a cast.
The code on Option E should be:
String p = (String) pageContext.getRequest().getAttribute("param");

Anonymous   
Printed
Page 566
Question 15, Items E & F, Handwritten Comments

The notes for options E and F should be swapped.

Anonymous   
Printed
Page 567
question 17

Both tags are declared to be non-empty in the TLD.
should read:
Both tags are declared to be non-empty and non-tag dependent in the TLD.

Anonymous   
Printed
Page 596
2rd & 3rd paragraph

Whenever the book says "value greater than zero" should read "non-negative value".
This occurs in paragraph 2 and 3.
Also, the last sentence in paragraph 3 should read:
"If you have two or more servlets with the same value, the Container may
choose the order in which this subset is initialized."

Anonymous   
Printed
Page 608
question 8, answer C

Option C should read:
"The method that retrieves these parameters has a signature that returns an Object."
(where "Object" should be in courier font to indicate the class name, not the generic concept)

Anonymous   
Printed
Page 631
The tomcat-users.xml file

<user name="Bill" password="coder" roles="Member, Guest" />
should be
<user username="Bill" password="coder" roles="Member, Guest" />

Anonymous   
Printed
Page 632
The last XML on the page

the DD-XML:

<security-role>
<role-name>Admin</role-name>
<role-name>Member</role-name>
<role-name>Guest</role-name>
</security-role>

should read:

<security-role>
<role-name>Admin</role-name>
</security-role>
<security-role>
<role-name>Member</role-name>
</security-role>
<security-role>
<role-name>Guest</role-name>
</security-role>

According to the servlet 2.4 spec, page 145 (13.4.19),
<role-name> is allowed only once within a <security-role>
element.

Anonymous   
Printed
Page 633
first call-out in handwriting font:

"mandatory named used by" should be "mandatory name used by"

Anonymous   
Printed
Page 635
Lower box, 2nd paragraph

"If you do NOT specify any <http-element>, then..."
should read:
"If you do NOT specify any <http-method>, then..."

Anonymous   
Printed
Page 637
Case 2

The second row should not have Diane and Annie crossed out.
All of these users would have permission to use the webapp.

Anonymous   
Printed
Page 638
arrow on the right of DD

the 2 arrows should be pointing at /Beer/UpdateRecipes/*, instead of /Beer/DisplayRecipes/* nor /Beer/UpdateUsers/*

Anonymous   
Printed
Page 639
authorization table (first row / last column); Case 1

Diane has two roles: 'Member' and 'Guest'
So as 'Guest', she has the permission to use the ressource and should not be crossed out.

Anonymous   
Printed
Page 642
1st paragraph

In HttpSerlvetRequest,
should read:
In HttpServletRequest,

Anonymous   
Printed
Page 643

The deployment descriptor on the right hand side of the page has two errors.
First the closing and opening <web-app> tags should be dropped; this is all a single DD.
Second, there should be only one <role-name> subelement in the <security-role> element.
Remove the Member and Guest roles as they are not needed in this example.

Anonymous   
Printed
Page 648
Sharpen your pencil

The third missing piece, at the end of the 4th line of the DD section, has a "/" after the blank box.
This "/" should be before the blank box.

Anonymous   
Printed
Page 655
Row 3, step 3

In the POST diagram the "S" at the end of "HTTPS" is crossed out. It should be underlined.

Anonymous   
Printed
Page 662
question 2, code

The web.xml configuration code is Question 2 is incorrect.
It should read as follows:
<auth-constraint>
<role-name>Bob</role-name>
</auth-constraint>
<auth-constraint/>
<auth-constraint>
<role-name>Alice</role-name>
</auth-constraint>

Anonymous   
Printed
Page 669
3rd line from bottom

"Want to manipulate the output from ever servlet in your app"
should read:
"Want to manipulate the output from every servlet in your app"

Anonymous   
Printed
Page 670
3rd paragraph (3rd objective)

Should be 11.2 and not 11.1

Anonymous   
Printed
Page 677
Step 2 of the stack

The last line of the second step reads:
"... until it reaches its chain. doFilter ()call."
Should be:
"... until it reaches its chain. doFilter() call."

Anonymous   
Printed
Page 679
LL

<filter-mapping> element declared at the top of the code ends with </filter>
it should end with
</filter-mapping>

In addition, there is a typesetting problem. The ligature fi is used in the courier
font in all the places where lowercase "fi" occurs (e.g. filter) The fi ligature
should not be used with a monospaced font for typesetting computer code.

Anonymous   
Printed
Page 689
Bottom right - number 2

'When the servlet asks for an it doesn't KNOW that it will get a "special" output stream.'
should read:
'When the servlet asks for an output stream, it doesn't KNOW that it will get a "special" output stream.'

Anonymous   
Printed
Page 691
In the else clause of the code example

The solution should include the code "fc.doFilter(req, resp);" in the else clause.

Anonymous   
Printed
Page 693
3rd line

streamUsed != pw
should be:
if ( (streamUsed != null) && (streamUsed == pw) ) {

Anonymous   
Printed
Page 693
15th line

streamUsed != servletGzipOS
should be:
if ( (streamUsed != null) && (streamUsed == servletGzipOS) ) {

Anonymous   
Printed
Page 697, 701
Question 3, first line

"Given this method in an otherwise properly defined Filter implementation:"
should be:
"Given the class UserRequest is an implementation of HttpServletRequest, and given this method
in an otherwise properly defined Filter implementation:"

Anonymous   
Printed
Page 697
bottom

The answer to question 3 on p. 701 is given as "E. None of the above".
However, for question 3 on p. 697, there is no choice E.

Anonymous   
Printed
Page 699, 703
Question 6, option C

"C. They can be used even when the application does not supprt HTTP"
should read:
"C. They can be used even when the application does not support HTTP"

Anonymous   
Printed
Page 703
question 5

option D should be checked.

Anonymous   
Printed
Page 705
bottom of the page

"accordion" is misspelled "accordian"

Anonymous   
Printed
Page 732
2nd paragraph

The comment
//do a data converstaion on the date parameter
should be changed to
//do a data conversion on the date parameter

Anonymous   
Printed
Page 741
execute method of BeerSelectAction

ArrayList result = be.getBrands(myForm.getColor());
SHOULD BE
List result = be.getBrands(myForm.getColor());

Anonymous   
Printed
Page 777,815
Question 31

Says:
how would you rite the JSP
Should Be:
how would you write the JSP

Anonymous   
Printed
Page 785
Question 43

options B-E should include the inner <role-name> tags as the read demonstrates here.
Example:
<auth-constraint>
<role-name>Member</role-name>
</auth-constraint>

Anonymous   
Printed
Page 785,823
Question 44

The bullet "* should reduce duplicate code" should be deleted.
It is not a feature of the design pattern described.

Anonymous   
Printed
Page 785 and 823
There is a typo in the open tag in Option B. It should read <auth-constraint>.

Anonymous   
Printed
Page 810
Question 22

we can make the question more clear by making this change:

"Which JSP code would..."
TO
"Given that /segments/footer.html is a static page, which JSP code would..."

Anonymous   
Printed
Page 825
Drop the comment for Option A

Anonymous