Java Reference
In-Depth Information
Because EnterEmpInfoJSP has much of the code we need for InsEmpInfo, we will use EnterEmpInfoJSP as the
base for InsEmpInfo and, again, save a lot of typing and mistakes.
6.
In c11, copy and paste EnterEmpInfoJSP as InsEmpInfo.jsp.
InsEmpInfo needs to be modified to include the HTML in StartIEIF and EndIEIF.
7.
In the Source or Properties view of InsEmpInfo, change the appropriate include tag's page
attribute to StartIEIF and EndIEIF.
8.
Save InsEmpInfo.
Let's make sure InsEmpInfo looks right.
9.
Run InsEmpInfo on the server.
The browser should look like Figure 11-11 . Notice that the function box is gone and the button has the text Insert.
Clicking the drop-down menu button will show the three state options.
Figure 11-11.
InsEmpInfo must now be modified to create EmpBean and invoke the insert function. However, before that can
be done the classes that provide the database functions must be created.
10.
Copy Employee and DBAccess fromTutorials/src/c10 to TutorialsWeb/Java Resources/src/
c11. (If you are working in a complex environment, the particular “database classes” and
the DB class need to be copied instead of DBAccess.)
Because the client-based application followed the MVC architecture (i.e., the model is separate from the view
and controller), implementing the database functions in a server-based application is almost as simple as copying
and pasting the model classes. In other words, because the model was built independently of the view, the classes
that comprise the model can be easily used in projects that use different views. If the client-based application had
embedded the database functions in a Frame subclass (i.e., combined the view and model functions), the database
functions could not have been simply copied into a server-based application.
 
Search WWH ::




Custom Search