Skip to content

Commit

Permalink
change bits on the backend with a variable now
Browse files Browse the repository at this point in the history
  • Loading branch information
raad1masum committed Sep 9, 2021
1 parent 90ace7b commit ef52d91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ public String image(Model model) throws IOException {
}

@GetMapping("/binary") // CONTROLLER handles GET request for /greeting, maps it to greeting() and does variable bindings
public String binary() {
public String binary(@RequestParam(name="bits", required=false, defaultValue="8") int bits, Model model) {
model.addAttribute("bits", bits); // MODEL is passed to html
return "starters/binary";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<!-- Hack 6: fix all warnings -->

<!-- <head> -->
<div layout:fragment="metadata" th:with="bits=16" th:remove="tag">
<div layout:fragment="metadata" th:with="bits=${bits}" th:remove="tag">
<title>Binary page</title>
<script>
const BITS = [[${bits}]];
Expand Down Expand Up @@ -109,7 +109,7 @@
<!-- </head> -->

<!-- <body> -->
<div layout:fragment="content" th:with="bits=16" th:remove="tag">
<div layout:fragment="content" th:with="bits=${bits}" th:remove="tag">
<h1 class="text-center">Binary Math with Conversions</h1>
<div class="container">
<div class="row justify-content-md-center">
Expand Down

0 comments on commit ef52d91

Please sign in to comment.