diff --git a/README.md b/README.md index ad80298..a6e6d45 100644 --- a/README.md +++ b/README.md @@ -20,3 +20,4 @@ The target platform is currently controlled using the GitHub Actions workflows a ## Getting Started If you are new and wanting to find out more information on the application and how to get started developing on it, take a look in at the [docs](docs/README.md) + diff --git a/src/main/java/com/github/demo/servlet/BookServlet.java b/src/main/java/com/github/demo/servlet/BookServlet.java index 13e69e1..6654098 100644 --- a/src/main/java/com/github/demo/servlet/BookServlet.java +++ b/src/main/java/com/github/demo/servlet/BookServlet.java @@ -71,10 +71,16 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) try { List books = bookService.getBooks(); - ctx.setVariable("books", books); - + + String searchString = req.getParameter("search"); + if (searchString != null) { + books = bookService.searchBooks(searchString); + } + + ctx.setVariable("books", books); + resp.setHeader("Content-Type", "text/html; charset=UTF-8"); - engine.process("books", ctx, resp.getWriter()); + engine.process("books", ctx, resp.getWriter()); } catch (BookServiceException e) { ctx.setVariable("error", e.getMessage()); resp.setHeader("Content-Type", "text/html; charset=UTF-8");