0

Can't locate my home.html in spring boot (Unexpected Error (type = Not found , status = 404))

Help me trace the error , pleaseee package com.example.demo; //MyFirstWebsiteApplication import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class MyFirstWebsiteApplication { public static void main(String[] args) { SpringApplication.run(MyFirstWebsiteApplication.class, args); } } //------------------------------------------------------------------------------------------------ //WebController package com.example.demo.controller; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import com.example.demo.entity.Product; import com.example.demo.repository.productRepository; @Controller @RequestMapping("/products/") public class WebController { private final productRepository ProductRepository; @Autowired public WebController (productRepository ProductRepository) { this.ProductRepository = ProductRepository; } @GetMapping("index") public String index() { return "index"; } @GetMapping("/home.html") public String home() { return "home.html"; } @GetMapping("/AddProduct") public String addProduct(Product product) { return "AddProduct"; } @GetMapping("productList") public String productList(Model model) { model.addAttribute("products", ProductRepository.findAll()); return "productList"; } @PostMapping("add") public String addEmployee(@Valid Product product, BindingResult result, Model model) { if(result.hasErrors()) return "AddProduct.html"; ProductRepository.save(product

19th Dec 2019, 11:36 AM
SingleName
SingleName - avatar
1 Answer
0
It looks like a chunk of code is missing. Mind uploading it properly as code?
24th Dec 2019, 6:47 PM
Randych
Randych - avatar