An application has a starter page with 2 buttons: "Add User" and "Users". You need to create handlers for them. To achieve that create 2 servlets:
- AddUserServlet
- GetUsersServlet
AddUserServlet should:
- be placed in
com.example.servlet
package - have
/add
url - should navigate to
/add
page - when adding a new user should:
- receive 2 params: firstName, lastName
- save user in Warehouse
- return request attribute "user"
- navigate to /add page
GetUsersServlet should:
- be placed in
com.example.servlet
package - have url
/users
- receive users from Warehouse
- as a result should:
- return request attribute "users"
- navigate to
/users
page
It is important that you use JavaEE, not JakartaEE and Tomcat 9.x or lower.