File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes SCWCD Study Companion (2nd Edition) errata Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "SCWCD Study Companion (2nd Edition) errata" Watch "SCWCD Study Companion (2nd Edition) errata" New topic
Author

SCWCD Study Companion (2nd Edition) errata

Miklós Karakó
Greenhorn

Joined: Mar 29, 2010
Posts: 1
Some typos and others from Charles Lyons' Sun Certified Web Component Developer Study Companion: SCWCD Java EE 5 2nd Edition (with Java EE 6 preview) book:

Chapter 1, page 15: After "A typical example ... data is:" the example
is missing.

Chapter 3, Question 12: The order in the question is correct.

Chapter 3, Question 13: Missing "?" at the end of the question.

Chapter 3, Question 4: I think C is correct. A: no such method in
GenericServlet., B, E: specified in interface ServletConfig, D:
Specified in interface Servlet.

Chapter 5, Question 5: You can change lineA and lineB, it also works on
Tomcat 6. (no flush, and just the character encoding is fix after
getWriter()).

Chapter 5, Question 6: B also correct. When the sendError exception
occur, the content already on the client.

Chapter 5, Question 7: C and D are the same.

Chapter 5, Queston 8: No space between the comma and "obtain":
"code,obtain".

Chapter 5, page 109, sendRedirect(): Tomcat sends 302, instead of 307.

Chapter 6, page 143, bottom of the page: "rd.include(myWrapper, req);" -
change "req" to "resp".

Chapter 6, Question 6: A's output: "FILE". The final "</div>" doesn't
appear on the output. (Tomcat 6)

Chapter 7, page 172: "wrp" vs "wrap" in the code block.

Chapter 7, Question 9, 10, 12: doFilter throws IOException,
ServletException is missing. So, these codes don't compile at all. I
saw this sort of type in other chapters too.

Chapter 8, Question 9, Question 11 exhibits: they don't compile, because
forward throw IOException, ServletException. It occurs previous chapters
too.

Chapter 8, Question 13: "HttpActivationListener" ->
"HttpSessionActivationListener "

Chapter 10, page 249, Expressions: the book sais: "If the contents
cannot be cast to a String..." Actually, "<%= new java.util.Date() %>"
works well. I think the container calls toString() method instead of
casting. (tested on Tomcat 6)

Chapter 10, question 12: The result with Tomcat 6 is compilation error:
Duplicate method _jspInit() in type q12_jsp.

Chapter 15, page 410: "Hence, you can always rely on instance or
static-class variables..." - static class?

Chapter 15, question 16: and doTag() doesn't catch invoke's exceptions.

Chapter 15, question 19: The correct answer is E. doTag() doesn't catch
invoke's exceptions.

Chapter 16, question 7: ${ session == null } writes true in a tag file.
I think B is correct.

Chapter 16, question 14: The book haven't metion before that JSP is a valid
value for body-content attribute. The first appear of JSP value is in
the chapter 17 (page 487).

Chapter 15, page 452: description are same for the two variable
declaration ("Entries for the partical date"). On page 458 also.

Chapter 17, question 7: In D you should omit the "mytag.tag" from the
value of tagdir attribute.

I got a question about DD's env-entry tag on the exam. It is gray on
page 205.
Daniel Rutledge
Greenhorn

Joined: Aug 04, 2008
Posts: 10
I got a question about DD's env-entry tag on the exam. It is gray on
page 205.


Yeah, I noticed this too and it bothered me a lot because it's such a simple thing for the book to get right, but a painful gap in knowledge for the test taker. I saw a question about the env-entry tag and one for ejb-ref, so I would tell people that basic questions on the EJB elements in the DD are fair game.
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

I've just visited this thread and decided to add what I've found.

Chapter 8, Question 10: I think E is correct instead of C [discussion]

Chapter 12, Question 18: I don't really know if there is a correct answer. More details here: [discussion]

Chapter 14, Question 17: I guess there is a typographical error, as the B and C answers shows "/catalogue/item/jsp" instead of "/catalogue/item.jsp". Therefore I don't think the answer B should be correct, as the question asks for the "/catalogue/item.jsp" file.


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

I guess I've found another bug.

SCWCD Study Companion, pp. 439 - The tag directive wrote:tag is similar to page in that more than one tag directive may be declared, but only one occurence of any given attribute may be declared, unless each occurence of that attribute has the same value. The import and pageEncoding attributes are exceptions to this rule, and may appear multiple times.


I guess that multiple occurrences feature affects only the import attribute, as the pageEncoding still can be present only once, even if it has the same value as previously declared.
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1676
    
  25

The import and pageEncoding attributes are exceptions to this rule, and may appear multiple times.

I don't know the context of this phrase but the pageEncoding can appear more than once in a translation unit:

JSP.1.10.1 The page Directive
...
A translation unit (JSP source file and any files included via the include directive)
...
There shall be only one occurrence of any attribute/value pair defined by this directive in a given translation unit, unless the values for
the duplicate attributes are identical for all occurrences. The import and pageEncoding attributes are exempt from this rule and can appear multiple times.


Regards,
Frits
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Howdy Frits!

Please, take a look at two sentences more from what you quoted:

JSP 2.2 Specification, JSP1.10.1 The page directive wrote:There shall be only one occurrence of any attribute/value pair defined by this directive in a given translation unit, unless the values for the duplicate attributes are identical for all occurrences. The import and pageEncoding attributes are exempt from this rule and can appear multiple times. Multiple uses of the import attribute are cumulative (with ordered set union semantics). The pageEncoding attribute can occur at most once per file (or a translation error will result), and applies only to the file in which it appears.


I dare to say that either I don't understand the sentence in the specification, or the text red-coloured is misleading and... wrong.

As I understand it - the import and pageEncoding are exempts from the multiple-occurrences rule, but not in the same way.

Import is cumulative (which means that can break the rule and appear more than once with different values) where the pageEncoding can appear only once (which means that can break the rule and can't appear even if it introduces the same value).

What do you think about it Frits?

EDIT: the exact title of the specification I quoted: JavaServer PagesTM Specification Version 2.2, Maintenace Release 2
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1676
    
  25

As I understand it - the import and pageEncoding are exempts from the multiple-occurrences rule, but not in the same way.

Correct.
Import is cumulative (which means that can break the rule and appear more than once with different values)

Correct, it can appear more than once in a file and more than once in the translation unit (A translation unit :JSP source file and any files included via the include directive) and it can have different values.

where the pageEncoding can appear only once

Once per file, but more than once in a translation unit (that is the key thing to grasp here). The pageEncoding's in the different file's of a translation unit can however be different.

Does this now clear your doubts?

Regards,
Frits
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Thanks a lot Frits!

So, to sum this up:

This does not work (different values of the same attribute in a file):

This does not work (the same values of the same attribute in a file, but the pageEncoding is an exception from the rule):

This does work (different values of the same attribute in a translation unit is acceptable for the pageEncoding):


EDIT: Maybe this discussion (about pageEncoding and tag directive) could be moved into the separate thread to keep this one clean and only errata-related and make it easy for other people to find solution about the page and tag directives?
Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610


Chapter 18, Question 16

I guess in the source code there is a missing "!", as the so presented code cannot be filled with any presented code fragments to fulfill the task


Chapter 18, Question 17 the exhibit DD code looks like this: (only relevant parts are left)



This code is missing the obligatory element <web-resource-name> inside <web-resource-collection> which even on page 519 is tagged as "1" so it must be present.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SCWCD Study Companion (2nd Edition) errata