|
|
When the Employee intranet portal is loaded, the UsersDBControl database control connects to the employee information database to retrieve the employee profile for the current user.
A database control is one example of a built-in Java control. This type of control makes it easy to access a relational database from your application. You simply issue SQL commands to the database and the database control performs the following tasks on your behalf:
When you add a new database control to your application, you specify the following:
View the UsersDbControl database control in WebLogic Workshop by performing the following steps:
The UsersDBControl database control and the methods associated with it are displayed, as follows:
The database control provides a number of methods for accessing the employee information database.
An instance of the UsersDBControl database control, m_DBCtrl, and the methods associated with it are displayed on the right-hand side of the page flow.
The m_DBCtrl instance is used to look up the current user and populate the InfoForm form bean with the employee profile information.
HttpSession sess= getSession();
HttpServletRequest req=getRequest();
joindb.UsersDBControl.User user= null;
.
.
.
user = m_DBCtrl.lookupUser(empId);
.
.
.
if(user==null)
return new Forward( "theFirstPage" );
else {
sess.setAttribute("employeeid",user.employeeid);
sess.setAttribute("employeename",user.employeename);
sess.setAttribute("ssn",user.ssn);
sess.setAttribute("departmentid",user.deptid);
sess.setAttribute("mgrname",user.mgrname);
sess.setAttribute("dateofhire",user.dohire);
sess.setAttribute("salary",user.sal);
sess.setAttribute("officeaddress",user.address);
sess.setAttribute("homephone",user.homephone);
sess.setAttribute("businessphone",user.bussphone);
sess.setAttribute("position",user.position);
sess.setAttribute("email",user.email);
}
return new Forward( "theFirstPage" );
}
.
.
.
protected Forward UsrInfo(InfoForm form)
{
return new Forward("success");
}
Before proceeding to the next step in the WebLogic Platform Tour:
|
|