Web Programming

Todo Web Application (Servlets)

The objective of this exercise is to implement servlets for maintaining a todo list.

Tasks

  1. Clone the GitLab repository Todo Web App.
  2. Add the jakarta.servlet-api dependency and the maven-war-plugin to the Maven project, and change the packaging type to war.
  3. Implement the TodoListServlet that uses the todo service to provide the following method:
    • doGet renders all the todos from the service and a link to the NewTodoServlet
    Make the servlet available at the path /todoList.
  4. Implement the NewTodoServlet that uses the todo service to provide the following methods:
    • doGet renders a form that allows a user to post a new todo
    • doPost adds a new todo to the service based on the request parameters and then redirects the browser to the TodoListServlet using the sendRedirect method of the response
    Make the servlet available at the path /newTodo.
  5. Define todoList (without slash) as welcome file in the deployment descriptor web.xml.
Solution