Rick Reumann wrote:
On 8/24/05, *David Haynes* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
I'm confused here. If the EmployeeBean object is embedded in the
EmployeeController and all the methods of EmployeeBean are
available via
the EmployeeController, why do you need the EmployeeBean directly?
Well for example after you used your backing bean to "get an employee"
(getEmployee method?), you would then want to display the employee
name on the page.. so you might have...
employeeBackingBean.employee.name
<http://employeeBackingBean.employee.name>
But that above would attempt to call 'getEmployee' which, if where my
initial confusion on 'best practice' came from since 'getEmployee'
could either mean 'get me the instance of the employee object from my
backing bean' or 'call some backend method to get me an instance of
the employee from the backend.'
--
Rick
Using Rick Hightower's model, the name element would be contained in
employeeBackingBean, so the reference would be employeeBackingBean.name.
(The bean contains the data manipulation - not the data storage - in his
modelling method.) Of course, it would be trivial to move the data
storage to the bean (which I am starting to favour) and then provide
accessor methods via the employeeBackingBean such as:
[in employeeBackingBean]
...
EmployeeBean eb = new EmployeeBean();
...
public String getName() {
return eb.getName();
}
...
So, all the elements of the EmployeeBean are available via the
employeeBackingBean in an unambiguous way. Or am I still missing the point?
-david-