Java Web Applications

Todo Web Application (Persistence)

The objective of this exercise is to persist the users and their todos in an XML file.

Tasks

  1. Create an XML object mapper in the UserAdmin class using the ObjectMapperFactory.
  2. Use the object mapper in the getInstance method to load the UserAdmin object from a file and to save it back to the file in the save method.
  3. In the servlets, save the UserAdmin object whenever a new user is registered or the todos of a user are changed.
  4. Add annotations to the model classes such that the XML data (e.g. todo-data.xml) is valid with respect to XML schema todo-data.xsd.


Solution