existingBook = bookRepository.findById(book.getIsbn());
+ if (existingBook.isPresent()) {
+ throw new DuplicateBookException(book);
+ }
+
+ final BookData savedBook = bookRepository.add(convertBook(book));
+ return convertBookData(savedBook);
+ }
+
+ private static Book convertBookData(BookData bookData) {
+ return new Book(bookData.getIsbn(), bookData.getName(), bookData.getAuthor());
+ }
+
+ private static BookData convertBook(Book book) {
+ return new BookData(book.getIsbn(), book.getName(), book.getAuthor());
+ }
+}
diff --git a/spring-web-modules/spring-boot-jsp/src/main/resources/application.properties b/spring-web-modules/spring-boot-jsp/src/main/resources/application.properties
new file mode 100644
index 0000000000..56638f8c1a
--- /dev/null
+++ b/spring-web-modules/spring-boot-jsp/src/main/resources/application.properties
@@ -0,0 +1,4 @@
+server.servlet.context-path=/spring-boot-jsp
+
+spring.mvc.view.prefix: /WEB-INF/jsp/
+spring.mvc.view.suffix: .jsp
\ No newline at end of file
diff --git a/spring-web-modules/spring-boot-jsp/src/main/resources/static/css/common.css b/spring-web-modules/spring-boot-jsp/src/main/resources/static/css/common.css
new file mode 100644
index 0000000000..a32d81c6a2
--- /dev/null
+++ b/spring-web-modules/spring-boot-jsp/src/main/resources/static/css/common.css
@@ -0,0 +1,10 @@
+table {
+ font-family: arial, sans-serif;
+ border-collapse: collapse;
+}
+
+td, th {
+ border: 1px solid #dddddd;
+ text-align: left;
+ padding: 8px;
+}
\ No newline at end of file
diff --git a/spring-web-modules/spring-boot-jsp/src/main/resources/static/error/4xx.html b/spring-web-modules/spring-boot-jsp/src/main/resources/static/error/4xx.html
new file mode 100644
index 0000000000..c27bd8bb7a
--- /dev/null
+++ b/spring-web-modules/spring-boot-jsp/src/main/resources/static/error/4xx.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Error
+
+
+Opps! 4xx Error Occurred.
+
+
\ No newline at end of file
diff --git a/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/add-book.jsp b/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/add-book.jsp
new file mode 100644
index 0000000000..3b815dfafb
--- /dev/null
+++ b/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/add-book.jsp
@@ -0,0 +1,23 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ Add Book
+
+
+
+
+ Successfully added Book with ISBN: ${savedBook.isbn}
+
+
+
+
+ ISBN:
+ Book Name:
+ Author Name:
+
+
+
+
+
\ No newline at end of file
diff --git a/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/error-book.jsp b/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/error-book.jsp
new file mode 100644
index 0000000000..c04756462d
--- /dev/null
+++ b/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/error-book.jsp
@@ -0,0 +1,18 @@
+<%--
+ Created by IntelliJ IDEA.
+ User: jason
+ Date: 3/13/21
+ Time: 10:39 PM
+ To change this template use File | Settings | File Templates.
+--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+
+
+ Error
+
+
+Reference: ${ref}
+Error Message: ${message}
+Object: ${object}
+
+
diff --git a/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/view-books.jsp b/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/view-books.jsp
new file mode 100644
index 0000000000..46bfbbac99
--- /dev/null
+++ b/spring-web-modules/spring-boot-jsp/src/main/webapp/WEB-INF/jsp/view-books.jsp
@@ -0,0 +1,30 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+
+
+ View Books
+
+ " rel="stylesheet" type="text/css">
+
+
+
+
+
+
+ | ISBN |
+ Name |
+ Author |
+
+
+
+
+
+ | ${book.isbn} |
+ ${book.name} |
+ ${book.author} |
+
+
+
+
+
+
\ No newline at end of file