[ Team LiB ] Previous Section Next Section

Workshop

The Workshop is designed to help you review what you have learned and help you further increase your understanding of the material covered in this hour.

Quiz

1:

What is the essential difference between Model 1 and Model 2 architectures?

2:

What's the difference between the Model, View and Controller in MVC?

3:

What are some of the benefits of MVC?


Answers

A1:

In a Model 1 architecture, a JSP is responsible for the control of the application. It also generates the content. In Model 2, these responsibilities are delegated to specialized components.

A2:

The Model represents the attributes and behavior of the application. The View represents the presentation of information produced by the application. The Controller defines how the user interface responds to user input. In a typical Web application, the model is represented by business components such as JavaBeans, Enterprise JavaBeans, or specialized classes. The controller is usually a servlet and the view is constructed using JSPs and occasionally servlets.

A3:

MVC was designed to provide flexibility. In many cases, the view is the component that is swapped out. For example, using the same underlying model, it's possible to use several views to interact with different clients—or even one client. If you've used Swing, you've seen MVC in action. You can change out the look and feel dynamically.


Activities

  1. Write a controller that implements basic security for an application.

  2. Extend the application above to handle different classes of users, directing them to pages that are distinct for each type.

    [ Team LiB ] Previous Section Next Section