Web Programming
Todo Web Application (Servlets)
The objective of this exercise is to implement servlets for maintaining a todo list.
Tasks
-
Clone the GitLab repository Todo Web App.
-
Add the
jakarta.servlet-api dependency and the maven-war-plugin to the Maven project, and change the packaging type to war.
-
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.
-
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.
-
Define
todoList (without slash) as welcome file in the deployment descriptor web.xml.
Solution