Spring MVC Beginner’s Guide勘误表

- 17 submitted: last submission 09 Dec 2016 

Page number: 213

Qauntity

should be:

Quantity

Page number: 167

additonally

should be:

additionally

Page number: 13

operating system architecture type (32 bit or 62 bit)

should be:

operating system architecture type (32 bit or 64 bit)

Pg no: 61 | Chapter 2: Time for action – creating a service object
(Step 4)

public void processOrder(String productId, long quantity) {
Product productById = productRepository.
getProductById(productId);
if(productById.getUnitsInStock() < quantity){
throw new IllegalArgumentException("Out of Stock. Available 
Units in stock"+ productById.getUnitsInStock());
}
productById.setUnitsInStock(productById.getUnitsInStock() - 
quantity);
}
}

should be:

public void processOrder(String productId, int count) {
Product productById = productRepository.
getProductById(productId);
if(productById.getUnitsInStock() < count){
throw new IllegalArgumentException("Out of Stock. Available 
Units in stock"+ productById.getUnitsInStock());
}
productById.setUnitsInStock(productById.getUnitsInStock() - 
count);
}
}

Pg no: 126 | Chapter 5: Pop quiz - static view (Option 2)

/resources/pdf/product/manuals/manual-P1234.pdf 
should be: 
/resources/product/manuals/manual-P1234.pdf

Errata type : Code   Page No: 97

In the section Time for action – serving and processing forms, step no 7 on page 97,

form:textarea id="description" path="description" rows = "2"/>

There should be a "<" at the start. It should be <form:textarea id="description" path="description" rows = "2"/>

Errata type: Code

In section Have a go hero – accessing the product domain object via a service, on page 65, in step 1,

It is:
List <Products> getAllProducts(); 
but it should be:
List <Product> getAllProducts();

Errata type: Code

In section Have a go hero – listing all our customers, on page 66, in step 4. It is:

List <Customers> getAllCustomers();

but it should be:
List <Customer> getAllCustomers();

Errata type: Code

In section Time for action – serving and processing forms, on page 96, in step 7,

It is :

<!-- Similarly bind <form:input> tag for name,
        unitPrice,manufacturer,category,unitsInStock and 
          unitsInOrder fields-->

It should be:

<%-- Similarly bind <form:input> tag for name,unitPrice,manufacturer,category,unitsInStock and unitsInOrder fields 
--%>

Errata type: Code

In section Have a go hero – adding multiple filters to list products, on page 92, in bullet point 3 It is:

http://localhost:8080/webstore/products/tablet/price;low=200;hi
gh=400?manufacturer="Google"

It should be

http://localhost:8080/webstore/products/tablet/price;low=200;hi
gh=400?manufacturer=Google

Errata type: Code

In section Time for action – creating a service object, on page 60 and 61. It is

void processOrder(String  productId, int count);

It should be:

void processOrder(String  productId, long quantity);

Type: Suggestion

On page 28, section Time for action – running the project, for step 1

The menu [Run As | Run on server] will not appear until you do [Maven | 
Update Project]

On page 64, section Have a go hero – accessing the product domain object via a service"

The URL in step 5 should be: 
http://localhost:8080/webstore/products/ 
instead of: 
http://localhost:8080/webshop/products/

Page: 106, section Time for action – externalizing messages

<spring:message code="addProdcut.form.productId.label"/>

should be:

<spring:message code="addProduct.form.productId.label"/>

Page: 58

Also, we learned earlier that if we configure our web application context as mentioned, 
it not only detects controllers (@controller),

should be:

Also, we learned earlier that if we configure our web application context as 
mentioned, it not only detects controllers (@Controller), 

Page: 57

Remember we learned that Spring creates and manages beans (objects) for every 
@controller class? 
should be: 
Remember we learned that Spring creates and manages beans (objects) for every 
@Controller class?

Page 252, Time for action – creating views for every view state (7th point)

<li><a href="<spring:URL value="/products/"/>">Products</a></li>

should be:

<li><a href="<spring:url value="/products/"/>">Products</a></li>

Page: 130, section Time for action – adding images to the product page

Given code is :

addProdcut.form.productImage.

Correct code is:

addProduct.form.productImage.label 

Page 142. Time for action – adding an exception handler Given code is: if(productById == null){ throw new ProductNotFoundException("No products found with the product id: "+ productId); } Correct code is: if(productById == null){ throw new ProductNotFoundException("No product found", productId); }

Page 130. Time for action – adding images to the product page

Given Code:

File(rootDirectory+"resources\images\"+
productToBeAdded.getProductId() + ".png"));
 
Correct code is:
 
File(rootDirectory+"resources/images/"+
productToBeAdded.getProductId() + ".png"));

A list of errors in this book are mentioned on this link along with their page numbers: https://docs.google.com/document/d/12fX-X23gfD_3scIS3MgAsSV3b2D87cFQaC94h3TYM-8/edit

原文地址:https://www.cnblogs.com/ys-wuhan/p/6282693.html