Requirements: Use the AddressBook XML schema [AddressBook.xsd developed previously during the semester] and use Java to create a mechanism to add and edit contacts the AddressBook.xml XML file. [AddressBook.xsl is AddressBooks stylesheet.]
The project was implemented in Java as JavaServer Pages (JSPs) that parsed and managed the file as a DOM structure. The starting menu (ContactManagerHome.jsp) parses the AddressBook.xml and generates a list of names (first name, last name) from the addressbook and displays a link to Edit or Delete the contact, as shown in the following screenshot.
Teasing out the data from the XML file required many nested
if statements due
to the XML Schema and the wide variety of elements that might make up any
For example, a contact might be married and have one (or more) children, and
a single person might also have children.
The code must also tease out
multiple business addresses and other such variety that can make up a Contact.
See findContact.jsp program
listing for details.
The project is contained in the addressbook.war file.
To deploy on Tomcat, drop
addressbook.war into the
of a Tomcat server. Doing so creates an
and all other structures for the application. Restart the Tomcat server if necessary.
Extra credit: In addition to JSP, implemented back-end as a Java Servlet (Servlet) that could be accessed by users from an HTML front page.
Choosing an approach was challenging. For user interface, should I use Swing components and create a full-fledged client, or create a Web-based UI? For the XML file itself, which of the many mechanisms is best? DOM? SAX? JAXB? The AddressBook project is a natural fit for SQL and an RDBMS, such as MySQL or PostgreSQL, and it would have been relatively easy to implement as such. But using XML as the basis was a great learning exercise, with hands-on experience with DTDs, XML Schema, Web Services (WSDL, SOAP), and creating Java (and Web) clients to invoke Web services and process results.