Spring Boot Bootcamp – Workbooks and Challenges
)}

Workbook 2.3

Screen Shot 2022-08-15 at 11.13.17 PM.png

Task 1

Add a speed of 45 as a model attribute.

model.addAttribute("speed", 45);

The + operator

You can add values using the + operator.

th:text="${modelAttribute} + ${modelAttribute}"

It will concatenate strings.

//hello //spring th:text="${modelAttribute} + ${modelAttribute}" >> Result: hello spring

It will add numbers.

//5 //5 th:text="${modelAttribute} + ${modelAttribute}" >> Result: 10

Use single quotes for plain text.

th:text="'plain text' + ${modelAttribute}"

Task 2

Inside sign.html, create a header element that displays the speed:

Screen Shot 2022-05-21 at 2.25.06 AM.png

Task 3

  1. Create an image element that displays slow-down only if the speed is higher than 60.
  2. Use th:if or th:unless.
  3. Give the image a width of 200.

Task 4

  1. Create an image element that displays speed-limit if the speed is lower than 60.
  2. Use th:if or th:unless.
  3. Give the image a width of 200.

Test case 1


Screen Shot 2022-05-21 at 2.30.36 AM.png

Test case 2


Screen Shot 2022-05-21 at 2.32.14 AM.png

Good Luck!

Feedback Summary
5.0
3 students
5

100%
4

0%
3

0%
2

0%
1

0%
Written Reviews
There are no written reviews yet.