View Code
Let’s take a look at the final steps of our application and learn how to code the view.
We'll cover the following...
Retrieve/List All
To show information about the authors of a book in the Retrieve/List All use case, the corresponding cell in the HTML table is filled with a list of the names of all authors with the help of the utility function util.createListFromMap, shown in the code below:
The utility function util.createListFromMap has the following code:
Create
To allow the selection of multiple authors to be associated with the currently edited book in the Create use case, a multiple selection list is populated with the instances of the associated object type. This multiple selection list (a select element with multiple="multiple") is shown in the HTML code below:
The Create UI is set up when we populate the selection lists for the selection of the authors and the publisher. This is done with the help of a utility method fillSelectWithOptions, as shown in the following program listing:
When the user clicks the “Save” ...