The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

cawel (4) [Avatar] Offline
#1
Fellow developers!

This post is meant to expose some of the errors of the "SCWCD exam study kit" book, 2nd edition. Since the errata hasn't changed since at least the very beginning of September 2005, I guess this post could be useful for both authors and readers. I do not pretend my errata to be 100% correct, and therefore feel free to comment/discuss.

It goes without saying that one would expect better from a technical book. My advice for those heading towards the SCWCD exam is to gloss over the Servlet 2.4 and JSP 2.0 specs as well as to read other pertinent online info sources, such as parts of the Sun's J2EE tutorial. I would go as far as to say that if:

1) you know the whole book by heart (without learning its errors!)
2) you are not looking for extra infos beyond the book
3) you have very little experience with JSP/servlets development

Then you'll get no more than 70%. Don't want to start a useless debate here, that's only my humble opinion.

That said, good luck in your study!



Chapter 3
p. 25 HTTP 1.0 (not HTTP 1.1) initially introduced GET, POST and HEAD requests.
p. 25 In the dissection of the HTTP request, the portion identified as a URL is not a URL but a URI, since it does not specify a protocol.


Chapter 4
p.39 If one wants to be rigourous, the code snippet on this page does not retrieve all header values, since many values can be associated with a single header name. With this code, only one header value would be retrieved per header name. In order to retrieve all header values, one must use getHeaders(String headerName) with each headerName. The same remark applies to the quizlet on p.40.
p. 51 The <load-on-startup> parameter in the deployment descriptor informs the servlet container to *initialise* the servlet on startup, and not only to *load* it (as all servlets are actually loaded on startup). Might be a detail, but the wording on p.51 is confusing after having read the state transition diagram on p. 46.
p. 59 Top of the page, the ?'s should be replaced with double quotes.


Chapter 5
p. 71 There is no XML tutorial in appendix B, but just a sample deployment descriptor file.
p. 73 "version=2.4" should not belong to the paragraph.
p. 76 It really took me a while to understand that the only way to possibly have a non-null path info is to have a url-pattern of "/[servlet path]/*" for some servlet in the descriptor file. Thus, figure 5.2 is true only if there is an url-mapping of "/helloServlet/*" in the web.xml. With an url-mapping of "/helloServlet/hello", figure 5.2 would be false. I believe this should be at least mentioned.
p. 79 There is a blank space in the one before last request URI. However, this blank space should also be present in the servlet path (it is absolutely not obvious as it is now).


Chapter 8
p. 125 Circular reference between p. 125 and p. 87. HttpSessionAttributeListener is nowhere dealt with. This might be viewed as trivial, except once one learn that there is no such thing as HttpSessionAttributeEvent (as one would expect), but rather a HttpSessionBindingEvent that goes with this listener.
p. 127 The meaning of the SessionDestroyed() method of the HttpSessionListener has changed with the Servlet 2.4 spec. And this implies that the Listing 8.4 would actually work. Servlet 2.4 spec (SRV.1.6.1 HttpSessionListener.sessionDestroyed): "Notification that a session is about to be invalidated before the session invalidation."
p. 133 The use of some equals signs are wrong in the HTTP post example. As of HTTP 1.1 spec, a message header must be followed by a colon and nothing else.


Chapter 9
p. 143 The use of some equals signs are wrong in the HTTP response example. As of HTTP 1.1 spec, a message header must be followed by a colon and nothing else.
p. 145 Unclear statement about HTTP Digest. It should be noted that the *servlet* specification does not mandate it, but the HTTP specification does mandate it.
p. 155 The note at the bottom is false with the current setup I have (Tomcat v5.5.9). Actually, with a FORM-based authentication mechanism, any existing users (and not only those allowed) will get access to the restricted resource, and thus "Tomcat [does not] authenticate[...] the user as expected". The FORM-based authentication is beyond buggy in Tomcat. (see Tomcat bug #13258, #11603, #20816)
p. 158 The last sentence at the end of the summary should be taken out. As this was probably true in the 1st edition, it is no longer the case, as the single-thread issues have been deprecated in the servlet API.


Chapter 10
p. 166 Error in title. It should be JSP syntax elements.
p. 171 In table 10.2, aVector is not declared anywhere in the code.
p. 171 In table 10.2, aFloatOjb should be "a variable referring to a float object".
p. 181 First off, there are 13 attributes for the page directive (the sentence sounds like there are only 12). Second, although the text states there are 12 attributes in table 10.5, there are actually 11. 'isELIgnored' is one missing ('isThreadSafe' is the other one, not important for exam 310-081), required for the exam, and not dealt with whatsoever in the chapter. Infos about isELIgnored can be found here: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html
p. 201 Indentation problem with the 3rd bullet point.


Chapter 12
p. 231 Quotes are missing in the first question of this page, for the value of xmlns:jsp.


Chapter 13
In general, this chapter does not prepare well enough for the exam, as far as EL is concerned. Some additional infos can be found here: http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JSPIntro7.html#wp71019
p. 239 Missing implicit variable - initParam: A Map containing an initialization parameter String.
p. 239 The phrasing for the descriptions is not clear.
p. 239 Last paragraph: "getParameterValues(String[] name)" should be "getParameterValues(String name)"
p. 241 The last question of the quizzlet is too early in the chapter, as one hasn't learned how to access elements in arrays yet. Since that's the only place where they used this kind of 'introductory learning' strategy in the whole book, I assume this is an error.
p. 245 The Functions.tld file has its xsi:schemaLocation wrong (a '/' is missing).
p. 246 In the TLD file, "java.lang.int" does not exist. The return type should be "int". And actually I did some tests, you can write garbage for the return type, it does not matter!! All the rest does though.
p. 247 It is missing one possibility: the <taglib-uri> element could also be a non-root relative uri.
p. 249 Review question #2: very bad phrasing leads to unclear question.


Chapter 15
p. 290 They do not mention that *.tld files (not necessarily named "taglib.tld") located in WEB-INF/lib will also be put into the taglib map (if they contain their own URI info) and therefore is another kind of implicit mapping (at least under Tomcat 5).
p. 292 The algo does not make a clear link with the taglib map concept, and this would make things so much easier.They are referring to the <taglib-uri> entry, but that is not necessary the very element in web.xml, but rather an entry in the taglib map. For example, with implicit mapping, there are no <taglib-uri> in web.xml, but there would be a <taglib-uri> entry in the taglib map. Confusing if we use this notation, isn't it?!
p. 299 A JSP script expression is represented by <%= %>, and not by <%= />.
p. 308 Review question #10: answer c should have double quotes: <c:out value="${var}"/>.
p. 315 The fragment attribute is missing.
p. 348 There is no such thing as IterativeTag. It should be IterationTag.


Chapter 17
p. 354 The figure 17.1 is confusing (although this is not a UML diagram), as it seems that the BodyTag interface does not extend the IterationTag interface.
p. 355 Bad phrasing in explanations of the step 1, when they refer to setter returning values.
p. 356 There is no such thing as setBody() in the SimpleTag interface. It should be setJspBody(). And this method does not have a return value as it is implied.
p. 358 According to the specified DTD, the required element "short-name" is missing in the MathTag.tld.
p. 359 The element "dynamic-attributes" is not valid in the specified doctype. One must use instead the XML schema "http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" instead.
p. 363 In the answer of the quizlet, they meant <body-content>, not <body-value>.
p. 364 In the first para of 17.3.1 should, it should be "page directives", and not "page attributes".
p. 364 "Unlike SimpleTags, tag files can also contain script elements." That's is a very confusing statement (at least for me it was), as you can't use script elements in tag files' bodies.
p. 365 The text does not say where the jar file must reside.
p. 366 "In the previous chapter, we showed how to declare JSP variables in tag library descriptors by adding <variable> elements". Never such thing has been done in the previous chapter.
p. 368 They said the <tag> element, but they actually meant to say the <attribute> element.
p. 369 The table 17.3 does not list the attributes of the tag directive, but those of the attribute directive.
p. 369 The definition for the fragment attribute is wrong. It should be: specify whether or not the attribute contains a fragment. Possible values: true, yes, false, no.
p. 373 review question #4 The answer in b should not contain double quotes.
p. 471 The explanation for review question #15 is correct, but the answer should be coherent and be a instead of c.


Exam Quick recap
p. 477 getHeaderValues() does not exist (and is a pitfall I saw both in practice exams and in my own exam). One should use getHeaders().
p. 483 There is no such thing as a HttpSessionAttributeEvent.
p. 501 Many errors on this page.
helmers (7) [Avatar] Offline
#2
Re: Errata proposal (50+ errors) (... another 30+ errors)
Finally got that paper... But there was this little voice in my head telling me that I had to post that notebook full of errata from that silly book that I used to prepare for the exam, so I do…

I omitted the errors from the posting from cawel on 3 Nov 2005 (Errata proposal (50+ errors)). Some errors might have been posted earlier though, I didn’t check.

Below, ‘JSP x.y.z’ refers to section x.y.z in the official JSP 2.0 specification.

General
This has been mentioned already, but I think it’s important enough to include in this errata list once again: The 2nd edition of the book is said to be ‘completely updated and newly revised’ for Servlet 2.4 and JSP 2.0. Then… why is it that the completely revised book is illustrating literally *all* examples of web.xml elements and tld elements (starting at section 5.2.2, P.73-75) by means of the version 2.3 DTD instead of the 2.4 XML schema?

Chapter 5
P.81 Question 2: item f missing
P.81 Question 3: should be abcdef instead of aaaaaab

Chapter 6
P.89 Title section 6.3.3: javax.servlet.http.HttpServletRequestListener does not exist. It should be javax.servlet.ServletRequestListener

Chapter 10
P. 180 The JSP in Listing 10.2 calls getServletContext() directly. But P. 180 says ‘Because the JSP page is converted into a servlet, we can call all the methods in a JSP page that we can call on a servlet. Hence we can get the ServletContext object via getServletConfig().getServletContext()’. The text doesn’t coincide with the listing. I think it should be mentioned much earlier in the chapter what the base class and implemented interfaces are of a JSP generated servlet (javax.servlet.http.HttpServlet according to middle P. 180).

Chapter 11
P. 195 Perhaps it’s worth mentioning that not every browser displays <%texttexttext%> as is. When I open an HTML page containing XXX <%texttexttext%> XXX with Internet Explorer 6, the only thing I see is XXX XXX.

Chapter 13
P. 237 I think this is a very simplistic view on JSP development: ‘… Second, these scripts still incorporate a great deal of business logic (Java) within presentation logic (HTML)’.
* The JSP pages I write usually do contain some Java code, but this is Java code for doing presentation logic (hide or display a section; positioning; etc) and hardly ever business logic.
* Since when is HTML presentation logic? HTML is presentation, not presentation logic.
* I think, in the end, what you’re trying to say is that EL simply tries to reduce the amount of Java code in a JSP, nothing more nothing less. Replacing Java code with equivalent EL statements does not change the logic in your JSP. (Unlike custom tags, that really can be used to remove logic from a JSP).
P. 239 The pageContext variable gives you access to the implicit objects mentioned in chapter 12, “Reusable web components”, such as application, session and request. This should refer to chapter 11, “Advanced topics” instead of chapter 12.
P. 240 [Listing 13.1 EL_variables.jsp] Please explain why ${param.num == 4} works if there is a request parameter with value 4. I would expect param.num to be an object of type String (all request parameters are Strings after all – you even stressed this in the last Quizlet of chapter 12!) so why does param.num == 4 work?! This is explained in JSP 2.8 ‘Type conversion’. At least give a pointer to this info! Giving an example like this to the reader, without any argumentation is very very confusing.
P. 241 …the following expressions produce the same result:
${header[‘host’}
${header.host}
… similarly …
${headerValues.host[‘0’]}
${headerValues.host[0]}
I don’t see the ‘similarity’. In the first example you say that in some cases the operators [] and . are equivalent. In the second example you say that the [] operator can be accessed by a String as well as an int.
13.2.1 in general is very vague. There are some very strict rules defined in JSP 2.3.4 (The operators “[]” and “.”). This chapter does not attempt at all to make the reader aware of (the existence of) these rules.
P. 242 There shouldn’t be a ] in ${headerValues.host.0]}
P. 244 Intro text of section 13.3: Now you do it again? Confusing business logic, presentation logic, and the way that we access business logic (whether it’s Java code in a scriptlet, or an EL expression)
P. 246 Section 13.3.2, last bullet: These data types must be resolvable inside an EL expression. But you’ve nowhere really explained how resolving works, and what data types are and are not resolvable. There’s a lot of rules involved in resolving EL variables. I don’t think ignoring them is a way to prepare for the exam.
P. 249 Summary: It is important to remember that … EL numbers must be of the Integer, BigInteger, Double or BigDecimal type.
Why’s that?! In the related JSP specification sections ‘JSP.2.3 General Syntax of the Expression Language’
and ‘JSP.2.8 Type Conversion’ I think it says that it should be possible to use any number type, including Short, Long, Float and primitive types…
P. 249 Question 2: What is the TLD in an EL function? An ‘EL function’ is nothing. EL can make use of functions that are mapped in a TLD. Are you asking for the purpose of a TLD, or the purpose of a function that is referred to by an EL expression?

Chapter 14
P. 255 ‘But what if this functionality is required by more than one JSP page. We have to repeat the same scriptlet code in all the Jsp pages.’ You make it seem as if the reader has no clue how to reuse code in JSPs, although in chapter 12 static includes were discussed, which can be used for exactly this purpose.
P. 282 Question 8: ‘Select two’ but P. 453 says ‘Select one’ and therefore forgets to mention that also answer a is correct.

Chapter 15
P. 287 Table 15.1 couple of spaces missing between two words.
P. 290 Section 15.2.2 Bullet 2: ‘Then, the container reads all the taglib.tld files present in the packaged JARs.’ But ‘JSP.7.3.4 Implicit Map Entries from TLDs’ says: “The container searches for all files with a .tld extension under /WEB-INF or a subdirectory, and inside JAR files that are in /WEB-INF/lib.” So also non-packaged *.tld files and packaged *.tld files different from META-INF/taglib.tld are included in the implicit map!
P. 300 I don’t think it is obvious from what we know at this point, that (and how)
<c:set var=”num”>
<c:out value=”${8+8}” />
</c:set>
assigns the value 16 to variable num. One page before, it was stated that <c:out ..> displays a value within the page…
P. 301 Section 15.4.4 ‘Conditional processing with JSTL’. Once again an absurd comment: “It’s important to notice the single quotes surrounding the variable’s test value. These must be present for the container to recognize the comparison.” Why? When I do this in Tomcat 5.5.9, it works just fine (and I couldn’t find any reason why the number should be enclosed in quotes):
<%pageContext.setAttribute("alpha", new Integer(1));%>
<c:if test="${alpha == 1}" var="resultaat" scope="page" >
The value of alpha is: ${alpha}
</c:if>
P. 303 Section should be called 15.4.5: URL handling JSTL tags.
P. 305 I can’t imagine that the exam questions are of this level. The first 3 pages are all about the taglib element in web.xml and what a taglib directive looks like. I can provide you another 1000 questions of this level if you’re interested (it’ll only take me about 20 seconds…)

Chapter 16
P. 310 As all JSP 2.0 containers are required to support the JSP 2.0 XML schema for TLD, and the DTDs for JSP 1.1 and JSP 1.2, I think listing 16.1 should use the TLD 2.0 XML schema instead of an old DTD (xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-jsptaglibrary_2_0.xsd" version="2.0"), and the book should mention that the JSP container is required to support other TLD formats. The whole discussion following it, is based on the old DTD and therefore misses all the new stuff from the JSP 2.0 XML schema for TLD. For instance, 16.1.3 (P. 315) doesn’t mention the attribute/fragment element.
P. 339 Table 16.10 Font size of the return values too Big.
P. 340 The only implicit variable available is pageContext. There rest is not a variable, it can be retrieved via the pageContext
P. 340-342 Bad coding practice. Why introduce a mapping from strings (“application”, “session” etc used in the JSP) to PageContext scope constants (PageContext.SESSION_SCOPE etc). Can’t we make scopeName a runtime expression and pass in <%=PageContext.SESSION_SCOPE%>?!

Chapter 17
P. 355 Step 1. SimpleTagSupport.setJspContext doesn’t return anything. It’s void.
P. 359 Adding Dynamic attributes. You present it as if DynamicAttributes interface can be used only by SimpleTags. Perhaps mention it in the previous chapter, or say here that is a general concept?
P. 363 ‘Since JSP is invalid, and empty is erroneous, we’ll set the value to tagdependent.’ Well well this is typical for this book. I would say, use tagdependent because that’s the way to make JspFragment echo the body’s contents verbatim (as stated in JSP 2.0 specs, section 13.6). Your argument is: Because the rest doesn’t work, let’s use tagdependent.
P. 364 ‘The only JSP elements that can’t be used in tag files are page attributes’. Must be: page directives.
P. 366 ‘In the previous chapter, we showed how to declare JSP variables in tag library descriptors by adding <variable> elements.’ I don’t think you did. You spent exactly 5 words on it in table 16.2 on P.313.
P. 367 page-encoding must be pageEncoding
P. 369 Table 17.4: ‘Tag file attributes within the tag directive’. The table name is incorrect (same as table 17.3) It should be something like ‘attributes of the jsp:invoke action’.

Chapter 18
P. 382 Table 18.5: Name: Transfer Object / Other name: Transfer Object
P. 394 Fact should be Facts.

Appendix C
P. 471 Answer to question 15 of chapter 17: Should be a instead of c.
P. 427 Chapter 8 Question 6: Stupid question. I interpreted this (because the answers are refering to a session object) as ‘a single session’ instead of ‘a session in general’.