From 47568088a3bfcd0d34bc4752012b2a46434de9ea Mon Sep 17 00:00:00 2001 From: Rhys Evans <EvansRM17@cardiff.ac.uk> Date: Thu, 23 Nov 2023 13:20:34 +0000 Subject: [PATCH] Successfully updated current webpages to incorporate controller GetMapping for URL address usage --- .../Webpages/WebpageController.java | 21 +++++++++---------- src/main/resources/static/test.html | 11 ++++++++++ .../{ => templates}/towns/caerleon.html | 0 .../{ => templates}/towns/caerphilly.html | 0 .../{ => templates}/towns/risca.html | 0 5 files changed, 21 insertions(+), 11 deletions(-) create mode 100644 src/main/resources/static/test.html rename src/main/resources/{ => templates}/towns/caerleon.html (100%) rename src/main/resources/{ => templates}/towns/caerphilly.html (100%) rename src/main/resources/{ => templates}/towns/risca.html (100%) diff --git a/src/main/java/Team5/SmartTowns/Webpages/WebpageController.java b/src/main/java/Team5/SmartTowns/Webpages/WebpageController.java index 4ff316f1..9b6e9d2d 100644 --- a/src/main/java/Team5/SmartTowns/Webpages/WebpageController.java +++ b/src/main/java/Team5/SmartTowns/Webpages/WebpageController.java @@ -3,27 +3,26 @@ package Team5.SmartTowns.Webpages; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.Controller; - +import org.springframework.stereotype.Controller; @Controller public class WebpageController { - @GetMapping() - public ModelAndView getXWebPage("/html page here"){ - ModelAndView modelAndView = new ModelAndView("Desired ViewName"); + @GetMapping("/Caerleon") + public ModelAndView getCaerleonPage(){ + ModelAndView modelAndView = new ModelAndView("towns/caerleon"); return modelAndView; } - @GetMapping() - public ModelAndView getYWebPage("/html page here"){ - ModelAndView modelAndView = new ModelAndView("Desired ViewName"); + @GetMapping("/Caerphilly") + public ModelAndView getCaerphillyPage(){ + ModelAndView modelAndView = new ModelAndView("towns/caerphilly"); return modelAndView; } - @GetMapping() - public ModelAndView getZWebPage("/html page here"){ - ModelAndView modelAndView = new ModelAndView("Desired ViewName"); + @GetMapping("/Risca") + public ModelAndView getRiscaPage(){ + ModelAndView modelAndView = new ModelAndView("towns/risca"); return modelAndView; } diff --git a/src/main/resources/static/test.html b/src/main/resources/static/test.html new file mode 100644 index 00000000..98a5d8ce --- /dev/null +++ b/src/main/resources/static/test.html @@ -0,0 +1,11 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>asdasd</title> +</head> +<body> +sadasdasdasd + +</body> +</html> \ No newline at end of file diff --git a/src/main/resources/towns/caerleon.html b/src/main/resources/templates/towns/caerleon.html similarity index 100% rename from src/main/resources/towns/caerleon.html rename to src/main/resources/templates/towns/caerleon.html diff --git a/src/main/resources/towns/caerphilly.html b/src/main/resources/templates/towns/caerphilly.html similarity index 100% rename from src/main/resources/towns/caerphilly.html rename to src/main/resources/templates/towns/caerphilly.html diff --git a/src/main/resources/towns/risca.html b/src/main/resources/templates/towns/risca.html similarity index 100% rename from src/main/resources/towns/risca.html rename to src/main/resources/templates/towns/risca.html -- GitLab