diff --git a/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java b/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java index 26cb4c3..82003ad 100644 --- a/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java +++ b/bookstore/src/main/java/com/fjordtek/bookstore/web/BookController.java @@ -96,13 +96,10 @@ public class BookController { ) { Book newBook = new Book(); - dataModel.addAttribute("book", new Book()); + newBook.setYear(Year.now().getValue()); + dataModel.addAttribute("book", newBook); dataModel.addAttribute("categories", categoryRepository.findAll()); - if (newBook.getYear() == 0) { - newBook.setYear(Year.now().getValue()); - } - httpServerLogger.logMessageNormal( requestData, bookAddPageView + ": " + "HTTPOK"