Exercise Solutions: Thymeleaf Views

Expanding our Events Schedule

  1. Comment out your previous code in the displayAllEvents method.

    //        List<String> events = new ArrayList<>();
    //        events.add("Code With Pride");
    //        events.add("Strange Loop");
    //        events.add("Apple WWDC");
    //        events.add("SpringOne Platform");

    Back to the exercises

  1. Fill your events HashMap with the names and descriptions of 3 coding events around town.

    events.put("Menteaship","A fun meetup for connecting with mentors");
    events.put("Code With Pride","A fun meetup sponsored by LaunchCode");
    events.put("Javascripty", "An imaginary meetup for Javascript developers");

    Back to the exercises

  1. Use fragments to store the address of the new tech hub where all of the programmers are hanging out. Use th:replace in your main template to bring in the address as a third column in your table. You may need to create a new fragments.html.

    <td th:fragment="address">1234 5th Street</td>

    Back to the exercises