We used several specialized classes in this chapter to build the backend of the component in the MVC design pattern. Although we could have opted for something simpler, using MVC gives us the flexibility to add more functionality to our component later on, in a predictable and standardized way. Output, database queries, and decision logic are managed separately, making our component easier to maintain.
The backend is now fully functional for entering our restaurant reviews. We've saved ourselves from writing routine SQL statements by extending the JTable
class. The HTML output is handled through views that generate add, edit, and list screens for the backend. These screens take advantage of back-end JavaScript to interact with the toolbar. Database queries populating these views are written separately in models.
Finally, functions have been added to the controller for saving and editing records. We call these functions by switching on the task
variable. This variable is set on the...