From c673bad9c38d34e6afbe20f1bec536b04b674cbe Mon Sep 17 00:00:00 2001 From: Rhys Nute <nuterd@cardiff.ac.uk> Date: Mon, 11 Dec 2023 19:16:54 +0000 Subject: [PATCH] fixed issues --- .../SmartTowns/localauthority/localAuthority.java | 8 ++++---- .../localauthority/localAuthorityRepositoryJDBC.java | 2 +- src/main/resources/templates/local-auth-data.html | 12 ++++++------ src/main/resources/templates/local-authorities.html | 11 ++++++----- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java b/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java index 4733c5dd..0915dcdd 100644 --- a/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java +++ b/src/main/java/Team5/SmartTowns/localauthority/localAuthority.java @@ -3,6 +3,8 @@ package Team5.SmartTowns.localauthority; import lombok.AllArgsConstructor; import lombok.Data; +import java.net.URL; + @AllArgsConstructor @Data public class localAuthority { @@ -12,7 +14,7 @@ public class localAuthority { private String city; private String county; private String postcode; - private String website; + private URL website; @Override public String toString() { return "localAuthority{" + @@ -50,9 +52,7 @@ public class localAuthority { return postcode; } - public String getWebsite() { + public URL getWebsite() { return website; } - - } diff --git a/src/main/java/Team5/SmartTowns/localauthority/localAuthorityRepositoryJDBC.java b/src/main/java/Team5/SmartTowns/localauthority/localAuthorityRepositoryJDBC.java index bdaa4fec..e2039617 100644 --- a/src/main/java/Team5/SmartTowns/localauthority/localAuthorityRepositoryJDBC.java +++ b/src/main/java/Team5/SmartTowns/localauthority/localAuthorityRepositoryJDBC.java @@ -24,7 +24,7 @@ public class localAuthorityRepositoryJDBC implements localAuthorityRepository { rs.getString("city"), rs.getString("county"), rs.getString("postcode"), - rs.getString("website") + rs.getURL("website") ); } public List<localAuthority> getAllLocalAuthority(){ diff --git a/src/main/resources/templates/local-auth-data.html b/src/main/resources/templates/local-auth-data.html index ec9f30bb..46994635 100644 --- a/src/main/resources/templates/local-auth-data.html +++ b/src/main/resources/templates/local-auth-data.html @@ -3,14 +3,14 @@ <head> <meta charset="UTF-8"> <title>Local Authority</title> - <link rel="stylesheet" href=css\landmarkFormStyle.css> - <link rel="stylesheet" href=css\templatingstyle.css> + <link rel="stylesheet" th:href="@{css\allTrails.css}"> + <link rel="stylesheet" th:href="@{css\templatingstyle.css}"> </head> -<header class="headerBar" th:fragment="header"> +<header th:insert="~{/towns/Templating.html::header}"></header> <body> <div id="container1"> <h2>Enter your Local authority</h2> - <form action="/localauthsub" method="post" id="data" object="localauthsub"> + <form action="/local-auth-data" method="post" id="data" object="localauthsub"> <p> <label for="localAuthorityName">Enter your local authority</label> <input type="text" name="authority_name" id="localAuthorityName"> @@ -39,9 +39,9 @@ <label for="website">Please enter your website address</label> <input type="url" name="web_site" id="website"> </p> - <input type="submit" value="Submit Data"> + <input type="submit" value="Submit"> </form> </div> </body> -<footer th:insert=/towns/Templating.html></footer> +<footer th:insert="~{/towns/Templating.html::footer}"></footer> </html> \ No newline at end of file diff --git a/src/main/resources/templates/local-authorities.html b/src/main/resources/templates/local-authorities.html index b67e7b42..f7f93853 100644 --- a/src/main/resources/templates/local-authorities.html +++ b/src/main/resources/templates/local-authorities.html @@ -3,16 +3,17 @@ <head> <meta charset="UTF-8"> <title>Local Authorities</title> - <link rel="stylesheet" href="../static/css/templatingstyle.css"> + <link rel="stylesheet" th:href="@{css\templatingstyle.css}"> </head> +<header th:insert="~{/towns/Templating.html::header}"></header> <body> <h1>Local Authorities</h1> <div id="councils"> - <ul th:each="localauthority:${localauthorities}"> - <li th:text="${localAuthority}"></li> + <ul th:each="localauthorities:${localAuthority}"> + <li th:text="${localauthorities}"></li> </ul> </div> -<p>Local Authorities please enter here</p><button><a href="local-auth-data" id="authority">Login</a></button> -<footer insert=towns/Templating.html::footer></footer> +<button><a href="local-auth-data" 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 -- GitLab