mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-20 22:35:49 +00:00
Creating a new view (Products)
This commit is contained in:
parent
217966d9c5
commit
75fe7380cb
5 changed files with 35 additions and 18 deletions
|
@ -1,4 +0,0 @@
|
|||
package org.springframework.samples.petclinic.product;
|
||||
|
||||
public class Product {
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package org.springframework.samples.petclinic.product;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class ProductController {
|
||||
|
||||
@GetMapping("/product")
|
||||
public String showProductList(){
|
||||
return "Hello";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package org.springframework.samples.petclinic.products;
|
||||
|
||||
public class Product {
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
package org.springframework.samples.petclinic.products;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Controller
|
||||
public class ProductsController {
|
||||
|
||||
@GetMapping("/products")
|
||||
public String showProductList(Model model){
|
||||
List<Product> prods = new ArrayList<Product>();
|
||||
model.addAttribute("Products", prods);
|
||||
|
||||
return "products/productsList";
|
||||
}
|
||||
}
|
10
src/main/resources/templates/products/productsList.html
Normal file
10
src/main/resources/templates/products/productsList.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<h3>asdasdasdad</h3>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in a new issue