Spring Web

Exercise: Todo MVC Application

  1. Clone the GitLab repository Todo and copy the REST service.
  2. Add the Thymeleaf starter spring-boot-starter-thymeleaf as Maven dependency.
  3. Implement the following Thymeleaf templates:
    • todo-list.html displays all todos with buttons to edit, complete and delete them, and a button to add a new todo
    • todo-form.html displays a form to enter the data of a todo and a save button
  4. Convert the REST controller TodoController into an MVC controller that supports the following requests:
    • GET / gets all todos and displays them
    • GET /create creates a todo and displays a form to enter its data
    • POST /save saves a todo
    • GET /edit/{id} finds a todo and displays a form to update its data
    • GET /complete/{id} finds a todo and marks it as completed
    • POST /delete/{id} deletes a todo
  5. Create the message bundle messages and use it to localize the texts in the templates.

Solution