Commit b2ca1f5a by Patryk Czarnik

prefix i suffix

parent 0ddcd023
...@@ -22,7 +22,7 @@ public class ProductController { ...@@ -22,7 +22,7 @@ public class ProductController {
public String getProducts(Model model) { public String getProducts(Model model) {
List<Product> products = productRepository.findAll(); List<Product> products = productRepository.findAll();
model.addAttribute("products", products); model.addAttribute("products", products);
return "/WEB-INF/templates/products.jsp"; return "products";
} }
@GetMapping(path="/products/{id}", produces="text/html") @GetMapping(path="/products/{id}", produces="text/html")
...@@ -30,9 +30,9 @@ public class ProductController { ...@@ -30,9 +30,9 @@ public class ProductController {
Optional<Product> optProduct = productRepository.findById(id); Optional<Product> optProduct = productRepository.findById(id);
if(optProduct.isPresent()) { if(optProduct.isPresent()) {
model.addAttribute("product", optProduct.get()); model.addAttribute("product", optProduct.get());
return "/WEB-INF/templates/product.jsp"; return "product";
} else { } else {
return "/WEB-INF/templates/missing_product.jsp"; return "missing_product";
} }
} }
......
...@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.ResponseBody; ...@@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
public class RootController { public class RootController {
@GetMapping("/") @GetMapping("/")
public String index() { public String index() {
return "/WEB-INF/templates/spis_tresci.jsp"; return "spis_tresci";
} }
@GetMapping("/hello") @GetMapping("/hello")
......
spring.application.name=PC37-SklepSpring spring.application.name=PC37-SklepSpring
spring.mvc.view.prefix=/WEB-INF/templates/
spring.mvc.view.suffix=.jsp
spring.datasource.url=jdbc:postgresql://localhost/sklep spring.datasource.url=jdbc:postgresql://localhost/sklep
spring.datasource.username=alx spring.datasource.username=alx
spring.datasource.password=abc123 spring.datasource.password=abc123
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment