It is our goal at Manning Publications to provide error-free texts. Inevitably, however, minor errors creep into every book in production. Any errors found in the book may be posted to the book's Author Online Forum.
The acronym XLS should read XSL whereever it appears.
The acronym XLST should read XSLT whereever it appears.
"Author Online" (page xxxii)
The end of the first sentence should read
"... questions, receive help from other users, and advice from the authors"
Listing 1.6 (page 24)
The line that reads
<%@ taglib uri="/WEB-INF/struts-form.tld" prefix="form" %>
Should be:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="form" %>
Listing 3.5 (page 79)
The return statement at the end of the listing should read
return (mapping.findForward(Constants.SUCCESS));
Section 3.4.17 (page 102)
The section title reads
The Struts ActionForward Action
but should be:
The Struts ForwardAction Action
Section 4.4.4 (page 122)
The last sentence before the code sample says
"nested with the <action-mappings> element"
but should be:
"nested within the <action-mappings> element"
Section 4.4.9 (page 126)
The acronym XLS should read XSL throughout, including the term "app.struts.XslForward".
In the second <set-property> statement, the value property should read:
value="/logon.xsl"
(No space.)
Listing 4.3 (page 131)
The name attribute in the <project> element is missing the closing quote. It should be
name="logon"
Section 4.11.1 (page 141)
The first sentence after the code snippet reads
sturts-config-reg.xml
but should be:
struts-config-reg.xml
Section 4.11.2 (page 142)
The second sentence refers to
input.do
but should be:
index.do
Section 5.1.1 (page 150)
In the text of the first bullet, the package for ActionForm is referenced as
org.apache.struts.ActionForm
but should be:
org.apache.struts.action.ActionForm
Section 5.3.1 (page 157)
In the DEFINITION, the end of the first sentence reads
"in lieu of a sharing common"
but should be:
"in lieu of sharing a common"
Section 5.3.4 (page 159)
The code snippet before "Protecting yourself from the nesting exploit" should read
aForm.getValues().setTelephoneText((String)request.getParameter("values.telephoneText"));
Section 7.2.14 (page 203)
The first code snippet should read:
Should be:
<action
name="/debug"
unknown="true"
forward="/pages/debug.jsp" />
Section 5.3.1 (pae 220)
In the "1.0 vs 1.1" note, second sentence, the reference to ActionServer should be to ActionServlet.
Section 8.5.1 (page 231)
Second sentence after the note, the sentence beginning with "Like the ContinueAction?" should be changed to "Like the SuccessAction?"
Section 8.5.1 (page 232)
In the second code snippet, the second line should read
(Closing brace at the end.)
Section 8.5.2 (page 238)
The second line should begin "the action".
Section 8.8 (page 249)
In the second sentence of the third paragraph, the sentence begins "Any many, many" but should read "And many, many".
Section 8.8 (page 251)
Second paragraph, second sentence. The sentence that reads
"But what if the parameters names are different?"
Should be:
"But what if the parameter names are different?"
Section 10.1.1 (page 269 and 270)
The first line of code on either page should be
ChaseBean chase = new ChaseBean("dog","cat");
Section (page 271)
The first line of the code (<jsp:useBean ...) should be in bold.
Section 10.3 (page 279)
In the second paragraph, the fourth taglib listed should be "nested".
Table 10.2 (page 280)
In the fourth row, the library listed should be "nested".
Section 10.3.1 (page 282)
In the "Runtime expressions" passage, the code examples should read:
Incorrect:
<html:link href='<%= "/" + name %>/index.jsp>'>
Correct:
<html:link href='<%= "/" + name + "/index.jsp" %>'>
Table 10.5 (page 286)
The row for the "cancel" tag should be deleted, as it does not have a corresponding HTML tag.
Table 10.5 (page 286)
The HTML element for the image tag should read:
<input type ="image">
Section 10.4.2 (page 296)
In the third code example, the property names "collection", "property", and "labelProperty" should be bold, and the value "imageOptions" should be in normal font.
Section 10.4.2 (page 297)
In the third line of the code swatch should end with an angle brace:
<TD><html:select property="hasImage">
Section 10.4.3 (page 302)
The first line of the third code example should read:
String selected = ((MyForm) form).getSelected();
Section 10.4.3 (page 304)
The last line of the first code sample should read:
</logic:notEqual>
Section 10.4.3 (page 305)
The last line of the first code example should read:
</logic:notEmpty></logic:present>
Section 10.4.3 (page 306)
The first line of the first code example should read
<SCRIPT language='javascript'
(No closing brace.)
Section 10.4.3 (page 306)
In the third code example, the script name in bold should be doPreview (rather than doScript).
Section 10.4.3 (page 308)
The second code example on the page should read
<html:rewrite forward="item" />
Section 10.4.3 (page 308)
The fourth line of the third code example should read
doOpenRemote(aBase + '?item' +
(No HC_)
Section 10.6 (page 317)
In the second paragraph, third sentence, the word "developer" should be "developers" (as in "wean developers").
Listing 12.1 (page 375)
The ninth line from the bottom in the code listing should read:
if (fields.length==0) {
Section 12.3.4 (page 382)
The term maxlength should be maxLength, in three places.
Listing 12.6 (page 388)
At the top of the listing, insert
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-validator" prefix="validator" %>
Substitute validator:errorsExist for validator:errorsPresent in two places.
Section 12.7 (page 391)
Listing 12.8 should not include the second return statement.
Section 12.11.6 (page 403)
In the first sentence after Listing 12.15, the reference to listing 12.11 should be changed to 12.14.
Section 13.2.2 (page 418)
In the code snippet at the bottom of the page, the third line should read:
String message = messages.getMessage(locale,"important message");
Section 13.2.3 (page 419)
The second sentence of 13.2.3 reads
"...first time is it needed..."
but should be:
"...first time it is needed ..."
Table 13.5 (page 419)
The example in the third row, third column should read:
{2,real,currency}
Section 13.2.3 (page 420)
In the third code snippet, the third line should read:
new ActionMessage("detected.ufo",ufoPlanet,ufoCount,today);
Section 13.2.5 (page 422)
In the first sentence following the 3rd code sample, the phrase "it is not" is written twice in a row.
Errata corrected in the third printing:
CHAPTER 1
Section 1.3.3 (page 9, sixth paragraph)
The text reads
"... it will just create a new thread for each request."
but would better read:
"... it will just assign a new thread for each request."
In practice, threads are pooled, so the container would not actually create a brand-new thread for each request.
Section 1.4.2 (page 16)
The second bullet should read:
Download and install Tomcat (full version)
Section 1.4.3 (page 19)
The first sentence should read:
"An ActionForm is a JavaBean that extends org.apache.struts.action.ActionForm."
Listing 1.1 (page 19)
The listing contains unnecessary semi-colons and references to "this".
package app; import org.apache.struts.action.*; public class RegisterForm extends ActionForm { protected String username; protected String password1; protected String password2; public String getUsername () {return this.username;}; public String getPassword1() {return this.password1;}; public String getPassword2() {return this.password2;}; public void setUsername (String username) {this.username = username;}; public void setPassword1(String password) {this.password1 = password;}; public void setPassword2(String password) {this.password2 = password;}; }
Might be better expressed as:
package app; import org.apache.struts.action.*; public class RegisterForm extends ActionForm { protected String username; protected String password1; protected String password2; public String getUsername () {return username;} public String getPassword1() {return password1;} public String getPassword2() {return password2;} public void setUsername (String username) {this.username = username;} public void setPassword1(String password) {this.password1 = password;} public void setPassword2(String password) {this.password2 = password;} }
Section 1.4.3 (page 20)
The test doesn't mention that the UserDirectory source code is available in the download. The following should be added as the second paragraph of page 20:
"We will also focus only on the Struts source files you need to create. For example, the UserDirectory class is part of the application's business logic. The Struts framework interacts with this class, but the UserDirectory is not part of the Struts layer. (You would need this class whether you used Struts or not.) If you are interested, the source code for UserDirectory is provided in the WEB-INF/classes folder of the register application."
Section 1.4.3 (page 22)
The <action> element in listing 1.3 reads
<action path="/register" type="app.RegisterAction" name="registerForm">
when it should read
<action path="/register" type="app.RegisterAction" name="registerForm" input="/register.jsp">
Section 1.4.3 (page 23)
The <form> tag in listing 1.6 reads
<form:form action="register.do">
when it should read
<form:form action="/register">
Section 1.4.4 (page 26)
The first two code snippets both read
type=" app.RegisterAction"
when they should read:
type="app.RegisterAction"
(No leading space).
Section 1.4.4 (page 26)
The second code snippet reads
type="RegisterForm"
when it should read:
type="app.RegisterForm"
Section 1.4.4 (page 26)
The sentence that reads:
The type attribute of the ActionMapping object is the name of the class that the ActionServlet will use to instantiate an ActionForm.
should be:
"... instantiate an Action."
CHAPTER 2
Section 2.2.3 (page 32)
The first box in figure 2.2 reads
Hyperlinks/ActionForms
when it should read
Hyperlinks/ActionForwards
Section 2.2.3 (page 32)
The third box in figure 2.2 reads
Custom actions/ActionForms
when it should read
Custom actions/Action classes
Section 2.2.3 (page 33)
The first sentence after the XML snippet should read:
"This element would create an ActionForward JavaBean ..."
Section 2.4.2 (page 42)
The sentence that reads:
JavaServer Pages are intended make dynamic ..."
should be:
"JavaServer Pages are intended to make dynamic ..."
Figure 2.9 (page 48)
At point 1.3.5,the figure depicts an Action forwarding to a JSP. This is imprecise in that the Action returns an ActionForward to the ActionServlet. The ActionServlet then forwards (or redirects) the request to another resource, such as a JSP.
CHAPTER 3
Listing 3.2 (page 67)
Both logic:present tags should read:
<logic:present scope="session" name="user">
Section 3.3.2 (page 68)
The fourth line from the bottom of the page should begin:
"Conversly, if the user bean is present, then we use a customized welcome."
Section 3.3.7 (page 77)
The second sentence should read:
If validate returns an ActionErrors collection which is neither null nor empty,
then the controller will save the ActionErrors object in the request context under a known key.
Section 3.3.7 (page 77)
The note refers to <html:error> tag when it should refer to the <html:errors> tag.
Section 3.3.8 (page 79)
In listing 3.5, the following block should appear after the try/catch.
if (!validated) { // credentials don't match ActionErrors errors = new ActionErrors(); errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.logon.invalid")); saveErrors(request,errors); // return to input page return (new ActionForward(mapping.getInput())); }
Section 3.3.8 (page 83)
The first code snippet should read:
return mapping.findForward("success");
Section 3.3.9 (page 85)
In line 3 of the code snippet, the line is truncated after "(LogonForm)". It should read:
LogonForm user = (LogonForm) session.getAttribute(Constants.USER_KEY);
Table 3.7 (page 88)
The second row, second column refers to "Welcome.jsp" but should refer to "Logon.jsp".
Table 3.8 (page 89)
The ninth row, second column refers to "Logoff" but should refer to "logoff".
Listing 3.9 (page 95)
Line 9 is missing a closing bracket, and should read:
<li><html:link forward="logon">Sign in</html:link></li>
Listing 3.10 (page 97)
The legend for Listing 3.10 should reference:
/pages/Logon.jsp
(Uppercase "L")
Listing 3.10 (page 97)
Line 8 has a misplaced quote, and should read:
<th align="right">Username: </th>
Section 3.4.10 (page 97)
Line 15 is missing the closing brace of the
</td> tag.
Section 3.4.10 (page 97)
The action-mappings element should be:
<action-mappings> <action type="app.LogonAction" path="/LogonSubmit" name="logonForm" scope="request" validate="true" input="/pages/Logon.jsp"/> <!-- ... --> </action-mappings>
Listing 3.11 (page 98)
The first line of the first comment should read:
* The session scope attribute under which the LogonForm
Listing 3.11 (page 98)
The word "SUCCESS" should be in bold like the others.
Section 3.4.14 (page 100)
The last sentence should read:
Be sure to edit the copy under /WEB-INF/src/java/resource and to launch the build process before running any tests.
Listing 3.12 (page 101)
Both logic:present tags should read:
<logic:present scope="session" name="user">
Section 3.4.17 (page 103)
The listing for the forward action reads:
<action path="/Welcome" type="org.apache.struts.action.ForwardAction" parameter="/pages/Welcome.jsp"/>
When the package name should be actions:
<action path=" /Welcome" type="org.apache.struts.actions.ForwardAction" parameter="/pages/Welcome.jsp"/>
CHAPTER 4
Table 4.1 (page 111)
In the first row, first column on page 111, the parameter should read "application" with a lowercase a.
Section 4.3.1 (page 114)
In the second paragraph after the Definition, the second sentence should read:
"The servlet container needs to do the same thing for the same reason."
(Insert the word "do".)
Section 4.6 (page 130)
The third paragraph refers to "section 4.3" but should instead refer to "section 3.4.3".
Section 4.11.2 (page 142)
"Inside the struts-config-reg.xml ..."
should be:
"Inside the struts-config-bid.xml ..."
CHAPTER 5
Section 5.6.7 (page 174)
The last code snippet near bottom of page ends with has a dangling "code" markup tag.
;</code>
The <code> tag should be ignored as it is not part of the example.
Section 5.6.8 (page 178)
The last line of code snippet of last code snippet reads
data.execute();
should be:
model.execute();
CHAPTER 7
Table 7.1 (page 196)
The descriptions of the "type" property and "className" property should be switched.
CHAPTER 8
Section 8.3.2 (page 226)
In the tip and the following paragraph "LookupDispatchAction" should read "DispatchLookupAction".
Section 8.5.1 (page 230)(
In the SuccessAction sub-section, the second paragraph and following code snip should read:
The
executemethod for a SuccessAction can be implemented as one line:
return mapping.findForward("success");
Section 8.5.1 (page 230)
The last sentence at the bottom of the page should read:
"An ActionMapping element might look like this:"
Section 8.8 (page 250)
The type attribute in the first code fragment that reads:
type="org.apache.scaffold.struts.RelayAction"
should be:
type="org.apache.struts.scaffold.RelayAction"
CHAPTER 10
Section 10.2.2 (page 276)
The snippet at the foot of the page that reads
\WEB-INF\struts.jar \WEB-INF\struts-bean.dtd \WEB-INF\struts-html.dtd \WEB-INF\struts-logic.dtd
should be:
\WEB-INF\struts.jar \WEB-INF\struts-bean.tld \WEB-INF\struts-html.tld \WEB-INF\struts-logic.tld
Table 10.5 (page 286)
In the last row, second column, the textarea element should be given as
<textarea>
Section 10.4.3 (page 313)
The code snippet in the middle of the page is missing the html:errors tags at the end of each line, and should read:
<P>Username: <html:text property="username"/> <html:errors property="username"/></P>
<P>Password: <html:password property="property"/> <html:errors property="password"/></P>
Section 10.5 (page 315)
The acronym given as XLST should be XSLT ("Extensible Stylesheet Language Transformations").
Section 10.5.3 (page 317)
The acronym given as XLST should be XSLT
CHAPTER 11
Section 11.3.2 (page 334)
The first sentence after listing 11.9 should read
"The key here is the standard JSP include directive that brings in the file containing our Definitions."
Section 11.4.3 (page 342)
The first line of text on the page reads
"This would ignore any instance of aBean in the page ..."
when it should read:
"This would ignore any instance of myBean in the page ..."
Section 11.5.7 (page 360)
The second "definition" xml element on the first half of page 360 should have the "name" attribute set to ".article.Result" instead of ".article.View".
Section 12.2 (page 372, last paragraph)
The text reads
"The validator-rules.xml has a <form> element .."
but should read:
"The validation.xml has a <form> element ..."
Although either file can contain any of the validator elements, the convention is to place the reusable validators in the "validator-rules" file and your application-specific forms in the "validations" file.
CHAPTER 12
Section 12.2 (page 373, fourth paragraph)
The text reads
"The ValidatorDynaForm class ..."
but should read:
"The DynaValidatorForm class ..."
Listing 12.4 (page 379)
At point (2), the
onsubmit="validateLogonForm(this)"
should be:
onsubmit="return validateLogonForm(this)"
Section 12.3.5 (page 383)
The line reading
<depends="required,minLength">
should be:
<depends="required,minlength">
Section 12.6 (page 389)
In listing 12.7, the closing tags for messages and
messagesPresent are given using the validator prefix rather than the logic prefix.
</validator:messages> <UL> <validator:messagesPresent>
should be:
</logic:messages> <UL> <logic:messagesPresent>
Listing 12.6 and 12.7 (page 398)
In both of the examples for the validator JSP tags, the onsubmit attribute is given as:
onsubmit="validateLogonForm(this)"
but should be:
onsubmit="return validateLogonForm(this)"
Section 12.9.1 (page 393)
The package name given as
org.apache.struts.validator.util.StrutsValidator
should be:
org.apache.struts.util.StrutsValidator
Section 12.11.7 (page 404)
The code snippet at the end of the section is from the validator configuration file, rather than the Application Resources file.
should be:
# /** # * Messages for Artimus application # */ # ... # -- article Form fields -- article.title.displayname=Title article.creator.displayname=Creator article.content.displayname=Content # ...
CHAPTER 15
Listing legends
In any source code legend that refers to /pages/article,
please substitute /article.
In any source code legend that refers to /pages/article/tiles,
please substitute /article/common.
Listing 15.10 (page 501)
The legend of listing 15.10 reads:
/pages/tiles/layouts/Base.jsp
but should be:
/pages/tiles/layouts/Article.jsp
Section 15.10.4 (page 502)
The reference to "message_1_0.jsp" in the last sentence of the first paragraph should be "message.jsp".
Section 15.10.4 (page 502)
In the last sentance of the first paragraph, the reference to "message_1_0.jsp" should be to "message,jsp".
Section 15.14 (page 516)
The title of section 15.14 reads "edit.jsp" but should be "form.jsp".
Listing 15.16 (page 517)
Line 4 of the listing,
<html:form action="/admin/article/Store"/>
should be removed as redundant. The following line contains the correct <form> element.
Section 15.16.3 (page 530)
In the second paragraph, the reference to listing 15.6 should be to listing 15.7.
register-complete.war
In "RegisterAction.java" the package name is given as "registerapp" when it should be "app".
Artimus README.txt
In the readme file for Artimus, it references a std-ext directory that should contains JARs you may need to add to your container's classpath. But the directory doesn't exist.
Everything you need now ships with Tomcat 4.1 or Java 1.4, so if that is what you are using, then you should be OK.
An update to the downloads is being prepared for users on other platforms. If you need any of these they can be obtained without charge from Sun or Apache: