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
-
Create an XML object mapper in the
UserAdmin
class using the ObjectMapperFactory.
-
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.
-
In the servlets, save the
UserAdmin
object whenever a new user is registered or the todos of a user are changed.
-
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