Java Reference
In-Depth Information
Figure 9-16.
Figure 9-16 is quite busy, so we'll walk through it step by step.
Step 1: The user starts the application. For example, a user issues the java EmployeeApp command or within
RAD runs the EmployeeApp class as an application by clicking the Run button. Either way, the user is running a Java
class that is considered part of the Controller.
Step 2: The EmployeeApp class is run and it creates an EnterEmpInfo object.
Step 3: The EnterEmpInfo frame is displayed.
Step 4: The user enters the information and clicks a button. In this case, clicking a button is how the user specifies
a new instruction to the controller. The diagram assumes that the user clicked the Display button.
Step 5: Based on the button that was clicked, EnterEmpInfo snaps into action. An Employee object (part of the
Model) is created, and its properties are set to the values entered in the frame.
Step 6: EnterEmpInfo then creates an EmployeeFrame object and passes the Employee variable emp.
EmployeeFrame is part of the View because it will display the employee information.
(The client-based Java technology doesn't let us fully segment the classes into the MVC categories. For example,
EnterEmpInfo actually has both View and Controller functions. When the empty EnterEmpInfo frame was displayed
and the data returned, EnterEmpInfo was acting as part of the View. However, when it responds to the button
and creates the Model component, Employee, and View component, EmployeeFrame, it is performing Controller
functions.)
Step 7: EmployeeFrame retrieves the data from the Employee object and displays it.
For server-based applications, the Controller is usually comprised of servlets that are invoked from Web pages
(which are part of the View). The Model is made up of Java beans, which we will explain in more detail in a later
section. The View is comprised of Web Pages and JSPs. Figure 9-17 shows this architecture.
 
Search WWH ::




Custom Search