Commit 9d34bc57 by Patryk Czarnik

przeniesienie szablonów to WEB-INF

parent d3568807
...@@ -7,7 +7,6 @@ import org.springframework.ui.Model; ...@@ -7,7 +7,6 @@ import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import sklep.model.Product; import sklep.model.Product;
import java.util.List; import java.util.List;
...@@ -23,7 +22,7 @@ public class ProductController { ...@@ -23,7 +22,7 @@ public class ProductController {
public String readAll(Model model) { public String readAll(Model model) {
List<Product> products = em.createNamedQuery("Product.findAll", Product.class).getResultList(); List<Product> products = em.createNamedQuery("Product.findAll", Product.class).getResultList();
model.addAttribute("products", products); model.addAttribute("products", products);
return "/products.jsp"; return "/WEB-INF/templates/products.jsp";
} }
@GetMapping("/{id}") @GetMapping("/{id}")
...@@ -31,9 +30,9 @@ public class ProductController { ...@@ -31,9 +30,9 @@ public class ProductController {
Product product = em.find(Product.class, productId); Product product = em.find(Product.class, productId);
if(product != null) { if(product != null) {
model.addAttribute("product", product); model.addAttribute("product", product);
return "/product.jsp"; return "/WEB-INF/templates/product.jsp";
} else { } else {
return "/missing_product.jsp"; return "/WEB-INF/templates/missing_product.jsp";
} }
} }
} }
...@@ -11,7 +11,7 @@ import java.time.LocalDateTime; ...@@ -11,7 +11,7 @@ import java.time.LocalDateTime;
public class RootController { public class RootController {
@GetMapping("/") @GetMapping("/")
public String root() { public String root() {
return "index.jsp"; return "/WEB-INF/templates/index.jsp";
} }
@GetMapping("/hello") @GetMapping("/hello")
...@@ -24,7 +24,7 @@ public class RootController { ...@@ -24,7 +24,7 @@ public class RootController {
public String currentTime(Model model) { public String currentTime(Model model) {
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
model.addAttribute("dt", now); model.addAttribute("dt", now);
return "show_time.jsp"; return "/WEB-INF/templates/show_time.jsp";
} }
} }
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Aplikacja Sklep Spring</title> <title>Aplikacja Sklep Spring</title>
<link rel="stylesheet" type="text/css" href="styl.css"> <link rel="stylesheet" type="text/css" href="../../styl.css">
</head> </head>
<body> <body>
<h1>Spis treści</h1> <h1>Spis treści</h1>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<html> <html>
<head> <head>
<title>Show time</title> <title>Show time</title>
<link rel="stylesheet" type="text/css" href="styl.css"> <link rel="stylesheet" type="text/css" href="../../styl.css">
</head> </head>
<body> <body>
<h1>Bieżący czas</h1> <h1>Bieżący czas</h1>
......
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