JavaServer Faces by Hans Bergsten This errata page lists errors outstanding in the most recent printing. If you have technical questions or error reports, you can send them to booktech@oreilly.com. Please specify the printing date of your copy. This page was updated March 14, 2006. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification Confirmed errors: (7) Figure 1-2 caption; "Figure 1-2. JThe..." should be "Figure 1-2. The..." (extraneous 'J') (14) Figure 2-2; "UIintput" component should be "UIInput" {18} Example 2-1; Second table row in sample code starts with tag instead of tag: News Letters: {19} Figure 2-3 "" should be "" Also, In the lower-right-hand corner of the graphic, "faces-config.xml" is misspelled as "faces-confix.xml". (19) Figure 2-3, box labeled "faces-confix.xml"; "manged-bean-name" should be "managed-bean-name" (two instances). "subsr" should be "subscr". (19) 4th paragraph, first line, right under Figure 2-3; "When the element is processed, the corresponding UIInput compo-" "" should be replaced with " {32} 3rd Paragraph; HTTP = Hypertext Transfer Protocol, not Transport (45) half way down page; "...invoke your servlet when it recieves a request..." should be: "...invoke your servlet when it receives a request..." {45} The URL pattern on page 45 should be: helloYou /helloYou/* (48) Filters and Listeners paragraph; These compont types are also often... should be: These component types are also often... {52} Bottom of page; The footer.jsp source should be shown after Example 4-3 and Figure 4-9 should show it's output. The footer.jsp source could look like this:
Copyright 2004 My Company {57} Top paragraph; (e.g., < and &) should be: (e.g., > and &) (60) 1st paragraph, line 5; The URL http://jakarta.apache.taglibs/ should be http://jakarta.apache.org/taglibs/ {60} Top para; The paragraph ends with "all dependent JAR file must also be installed in the WEB-INF/lib directory." should be: "all dependent JAR files must also be installed in the WEB-INF/lib directory." (60) 3rd paragraph, line 5; In your JSP page, just to use a taglib... should be: In your JSP page, just use a taglib... (62) 1st paragraph The first paragraph on page 62 should actually be removed; it refers to an example ("product catalog example") which doesn't exist. (62-63) Code at bottom of 62 and middle of 63; It says "Sorry, not products..." in both places. it should say "Sorry, no products..." (66) Paragraph following Figure 5-2.; "different storage medias" should be "different storage media". {70} Paragraph 2 and code sample; Names of methods in text do not quite match code. The names in the text should be getCurrentEntryId() and setCurrentEntryId() instead of getCurrentEntry() and setCurrentEntry() (73) bottom; matches a search criteria. should be: matches a search criterion. {81} top of page; This web.xml descriptor fragment is incorrect. It is missing the enclosing tag. It should be: FORM /login.jsp /loginerror.jsp {94} example in page; In the example, the "to:" input - should be : (98) 6th paragraph; Second sentence says: First, the path starts with a /jspbook prefix. should be: First, the path starts with a /jsfbook prefix. (103) First complete paragraph; The inline example of combining a bean property value with an EL operator is incorrect. "#{report.status == 'open'}" should be "{#report.status == 1}". (107) last paragraph; instead of "... so it consults the jsf-config.xml ..." it should be "... so it consults the faces-config.xml ..." (109) end of 2nd dotted paragraph; ... the component loses its state when its removed from the view. should be: ... the component loses its state when it's removed from the view. (109) Example code for Figure 6-6; The code that generates the "You're logged in as..." text and provides the links for logout and preferences permaturely close the h:outputLink tags. e.g. code sample says: [ ] it should say: [ ] (110) bottom of code block; The opening tags are incorrectly printed as empty tags. They should be closed with a ">" instead of "/>" as printed. (119) bottom of HTML markup; The value binding for the commandButton #{reportHandler.addEntryDisabled} should be #{reportHandler.editDisabled} (119) Example 7-2.; under the lines with both tag should be
(120) Table 7-3; First paragraph under Description label: ...is a decimal above a minimum or a maximum should be: ...is a decimal above a minimum or below a maximum This paragraph under Description label: ...is a nondecimal above a minimum or a maximum should be: ...is a nondecimal above a minimum or below a maximum (123) 2nd paragraph, line 2; "a action" should read "an action." (124) 1st paragraph; end of last sentence: ... that sets the ... properties, and leave the description undefined. should be: ... that sets the ... properties, and leaves the description undefined. {125} Last paragraph, line 8; Variable expenseType should be expenseTypes (126) Last paragraph, line 3; "application-specific message" should be "application-specific messages." (127) Second paragraph, line 2; The phrase "actions shows" should be "actions show. [130] Last paragraph, line 2; this should be rephrasedlike this: The EditableValueHolder interface extends the ValueHolder interface, adding properties related to a user provided value. A class that represents a component type with a value the user can change (e.g., the class for the UIInput component) must implement the EditableValueHolder interface. {131} 3rd paragraph, line 6; not_later should be not_later_detail. <133> First paragraph in Using a Custom Validator in a JSP Page, second line "To use a custom validator in a JSP page, you need a JSP custom action that configures the converter and attaches it to a component." "converter" should be "validator" <134> Third paragraph in Developing a Validator Custom Action, fifth line: "Example 7-8" should be "Example 7-6" (135) 4th paragraph, line 4; "an JSP" should read "a JSP." <135> Sixth paragraph, first line: "" should be "" {137} first example; should be: <154> Third paragraph, second line "includeExtensions" should be "includeSpecial" (165) last paragraph, 3rd line; ...example, and in links to a... should be: ...example, and it links to a... {168}, line 15 in the code snippet "context" is used as both the assigned variable name and the first method argument. The argument should be replaced with a call to the getServletContext() method, i.e.: FacesContext context = fcFactory.getFacesContext(getServletContext(), request, response, lifecycle); [168] Example code; There are a few typos in the example. It should look like this: LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY); Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE); FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); // The "context" argument replaced with "getServletContext()" below FacesContext context = fcFactory.getFacesContext(getServletContext(), request, response, lifecycle); Application application = context.getApplication(); ViewHandler viewHandler = application.getViewHandler(); // The "facesContext" argument replaced with "context" below UIViewRoot view = viewHandler.createView(context, "/myView.jsp"); context.setViewRoot(view); // The "context" argument added lifecycle.render(context); (175) Last paragraph; reportModel should be reportsModel (177) 2nd snippet; In the book it shows /expense/stage1/reportListArea.jsp #{reportHandler.select} success /expense/stage1/entryListArea.jsp It should be: #{reportHandler.select} success /expense/stage1/entryListArea.jsp The shouldn't be there because the same rule applies to more than one view. (199) 1st line (1st paragraph); a file named lables_en_US.properties ... should be: a file named labels_en_US.properties ... (200) Example 11-2 "datestyle" should be "dateStyle" (201) Second paragraph "datestyle" should be "dateStyle" (208) Example 11-4 tag content; To go along with what is displayed in Figure 11-4, the <title> tag content should be changed FROM: <title>Non-Western Languages Localization TO: Supporting Non-Western Languages (211), first paragraph, first line "The JSP page in Example 4-1 contains ..." should be "The JSP page in Example 11-4 contains ..." (221), third paragraph, seventh line "For an with ..." should be "For an action element with ..." (226), sixth paragraph, second line "http://www.Jakarta.apache.org/struts/" should be "http://jakarta.apache.org/struts/" (229) Text and code sample of Example 12-10; Names of class in text does not match sample for struts version. public class UpdateProfileAction extends Action { should be: public class StoreMsgAction extends Action { (235), first paragraph, ninth line "and requires that the JSP component actions ..." should be "and requires that the JSF component actions ..." {240} The code at the top of the page shows .. this should be .. (245), second paragraph, second line "The addLeafNode() method loops ..." should be "The addLeafNodes() method loops ..." (251), second paragraph, fourth line "because the JSP component actions are ..." should be "because the JSF component actions are ..." {251} Code Example (continued); int first = data.getFirst(); int rows = data.getRows(); for (int i = first, n = 0; n < rows; i++, n++) ... should be int first = data.getFirst(); int rows = data.getRows(); for (int i = first, n = 0; rows == 0 || n < rows; i++, n++) { ... (p253), last paragraph, second line "in the faces-config.xml class" should be "in the faces-config.xml file" {260}, last paragraph, last line "The Page class is an inner class" should be "The Page class is a nested class" <276>, second paragraph, starting with "All in all, ..." This paragraph should be replaced with: "All in all, we need to develop a custom renderer for the outer table, a custom component for the tab control label (which uses a standard renderer), and custom actions for both component/renderer combinations. We must also register the custom component and the custom renderer." (279), second paragraph, third line "the currently selected tag has ..." should be "the currently selected tab has ..." {308}, ninth statement in the code snippet grid.getAttributes().put("columns", "2"); should be grid.getAttributes().put("columns", Integer.valueOf("2")); [314] renderResponse code sample; else { Iterator i = component.getChildren().iterator(); while (i.hasNext()) { renderView(context, (UIComponent) i.next(), state); } } should read: else { Iterator i = component.getChildren().iterator(); while (i.hasNext()) { renderResponse(context, (UIComponent) i.next()); } } (318), last paragraph, second line "defined by the combination of a view specification class and ..." should be "defined by the combination of a view specification file and ..." {334, 335} and Attributes tables For both these actions, the Description column for the "action" attribute should be extended with this text: ", or a static String value to be used as a hardcoded action outcome" {348 - 352} , , , Attributes tables The EL-expression type column should say "Any" for the "value" attribute row for all these actions. {428} SelectItemGroup constructors The names for the last two constructors should be SelectItemGroup instead of SelectItem. {430} Second paragraph "a component with the rendered property set to true isn't rendered" should be "a component with the rendered property set to false isn't rendered" (432) First paragraph "can be specified by the first and row attributes" should be "can be specified by the first and rows component properties" (482) getActionListener() description "Returns an instance of the default ActionListener instance used for ActionSource ..." should be "Returns an instance of the default ActionListener used for ActionSource ..." (489) renderView() description It's duplicated. One copy should be removed. [496] writeText() description A parameter is missing in the signature. It should look like this: public abstract void writeText(Object text, java.lang.String property) throws java.io.IOException (496) writeText() description "The property name may be used to associate the attribute with ..." should be "The property name may be used to associate the text with ..." (510) getValue(Object base, Object property) description "while getting the type" should be "while getting the value" (511) isReadOnly(Object base, int index) description "while getting the value" should be "while checking the writeability" (511) isReadOnly(Object base, Object property) "while getting the type" should be "while checking the writeability" (511) setValue(Object base, int index, Object value) "while getting the value" should be "while setting the value" (511) setValue(Object base, Object property, Object value) "while getting the type" should be "while setting the value" (512) getExpressionString() description "Returns the method binding expression ..." should be "Returns the value binding ..." {520} createResponseStream() signature The parameter name is missing. It should be: public abstract javax.faces.context.ResponseStream createResponseStream(java.io.OutputStream out) {520} createResponseWriter() signature The first parameter name is missing. It should be: public abstract javax.faces.context.ResponseWriter createResponseWriter(java.io.Writer writer, String contentTypeList, String characterEncoding) {533} createValidator() description "instance of the converter identified ... " should be "instance of the validator identified ..." {539} example snippet Copy/paste error. It should be: com.mycompany.jsf.MyStateManager