diff --git a/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java b/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java index 4e25da2a13d2d1cdc459db3fd6facae099d99bc9..5e289e9f3387af7d76675d26803247cab3f172b2 100644 --- a/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java +++ b/src/main/java/Team5/SmartTowns/Organisation/organisationControllers.java @@ -21,6 +21,7 @@ public class organisationControllers { public ModelAndView getLocalAuthoritiesPage(){ ModelAndView mav = new ModelAndView("local-authorities"); List<localAuthority> localAuthority = localAuthorityRepository.getAllLocalAuthority(); + mav.addObject("localAuth", localAuthority); return mav; } @GetMapping("/localForm") @@ -33,6 +34,7 @@ public class organisationControllers { private localAuthorityRepository localAuthorityRepository; @PostMapping("/local-auth-data") public ModelAndView localAuthSent(@Valid @ModelAttribute("localAuthority")localAuthority localAuthority, BindingResult bindingResult, Model model ) { + List<localAuthority> localAuthorityList = localAuthorityRepository.getAllLocalAuthority(); if (bindingResult.hasErrors()){ ModelAndView modelAndView = new ModelAndView("local-auth-data", model.asMap()); return modelAndView; diff --git a/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java b/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java index 7bed36b9c48f30b5fc903616bb587cde6d9399f8..eb84e592ee40b1eb460d03bbb1530db38fcc86df 100644 --- a/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java +++ b/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java @@ -19,15 +19,15 @@ public class localAuthority { private URL website; @Override public String toString() { - return "localAuthority" + - localAuthorityName + '\'' + - address1 + '\'' + - address2 + '\'' + - city + '\'' + - county + '\'' + - postcode + '\'' + + return "Local Authority:" + " " + + localAuthorityName + '\'' + " " + + address1 + '\'' + " " + + address2 + '\'' + " " + + city + '\'' + " " + + county + '\'' + " " + + postcode + '\'' + " " + website + - '.'; + " "; } public String getLocalAuthorityName() { diff --git a/src/main/resources/templates/local-authorities.html b/src/main/resources/templates/local-authorities.html index e416d25fdf393d697deed2f94651369127b86e91..bdc00cdb181cebca878e56f0aa7711c7dc313c4e 100644 --- a/src/main/resources/templates/local-authorities.html +++ b/src/main/resources/templates/local-authorities.html @@ -10,11 +10,11 @@ <body> <h1>Local Authorities</h1> <div id="councils"> - <ul th:each="localAuthority:${localAuthority}"> - <li th:text="${localAuthority}"></li> + <ul th:each="local:${localAuth}"> + <li th:text="${local}"></li> </ul> </div> -<a href="/localForm" id="authority"><button>Local Authorities please enter here</a></button> +<button><a href="/localForm" id="authority">Local Authorities please enter here</a></button> <footer th:insert="~{/towns/Templating.html::footer}"></footer> </body> </html> \ No newline at end of file