diff --git a/README.md b/README.md index 08b3fd76..f1cffdf9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Java Coffee Shop +# Java コーヒー Shop This application is an intentional vulnerable Java Spring-Boot application with Thymeleaf. It is use for training purposes only! diff --git a/src/main/java/org/workshop/coffee/controller/HomeController.java b/src/main/java/org/workshop/coffee/controller/HomeController.java old mode 100755 new mode 100644 index ba17dceb..c589f841 --- a/src/main/java/org/workshop/coffee/controller/HomeController.java +++ b/src/main/java/org/workshop/coffee/controller/HomeController.java @@ -40,6 +40,11 @@ public String searchProducts(Model model, @RequestParam String input) { return "index"; } public List searchProduct (String input) { - return null; + //create sql query + String sql = "SELECT * FROM product WHERE product_name LIKE '%" + input + "%' OR product_description LIKE '%" + input + "%'"; + //create query + List products = em.createNativeQuery(sql, Product.class).getResultList(); + //return the list of products + return products; } } \ No newline at end of file