lien bdd & html liste des articles

This commit is contained in:
ionak
2024-04-22 22:08:12 +02:00
parent 3480ce9aeb
commit 2fcafc0ea1
22 changed files with 211 additions and 34 deletions

View File

@@ -1,5 +1,8 @@
package fr.eni.enchere.controllers;
import fr.eni.enchere.bll.ArticleService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
@@ -8,11 +11,21 @@ import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class AccueilController {
public AccueilController() {
private static final Logger logger = LoggerFactory.getLogger(AccueilController.class);
private ArticleService articleService;
public AccueilController(ArticleService articleService) {
super();
this.articleService = articleService;
}
@GetMapping({"/", "/accueil"})
public String viewAccueil(Model model) {
logger.info("Liste des articles : {}", articleService.findAllArticle().getLast());
model.addAttribute("articles", articleService.findAllArticle());
return "accueil";
}