myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <rick.reum...@gmail.com>
Subject Re: confusion on best practices in regard to a VO in BackingBean
Date Wed, 24 Aug 2005 18:13:07 GMT
On 8/24/05, CONNER, BRENDAN (SBCSI) <bc1378@sbc.com> wrote:
> 
> 
> Our CalculatorBean would be a simple JavaBean containing firstNumber,
> secondNumber, and result.
> Our CalculatorAction class would have a field called calcBean (and its
> getter and setter), which is set by JSF, plus the methods add() and
> multiply(). (Note that, since the reference to calcBean is a managed
> reference, CalculatorAction does *not* instantiate calculatorBean
> itself.)
> 
> The JSP would then refer to #{calcBean.firstNumber},
> #{calcBean.secondNumber}, #{calcBean.result}, #{calcAction.add}, and
> #{calcAction.multiply}.



Ok, I really like this, but help me out with trying to understand a totally 
noob concept... to help me relate, lets change the above to an "Employee" 
and an "EmloyeeAction"...

First what I want to accomplish...

I'm on a JSP and I'm viewing a list of employees. I click on a button next 
to the employee that should bring me to an 'editEmployee' screen after 
looking up the employee from backend based on id.

Clicking on the button should call the "EmployeeAction" backing bean and 
retrieve an "Employee" (which using your scenario would also be a managed 
bean). The Employee object is returned from the EmployeeAction's 
'getEmployee' method. 

We now foward on to the 'employeeForm.jsp'

*Which backing bean am I now to use on this employeeForm.jsp* and how does 
it manage to get a handle to the "Employee" that we just returned from our 
EmployeeAction if we are using request scoped managed beans? 

There seems to be black-box stuff going on that I'm unclear about. I'm used 
to stuffing the "Employee" object into the request in my Action (struts 
terms), so I'm having trouble grasping how my resulting page is going to 
have access to this employee object that was just returned in my managed 
"EmployeeAction" bean?

Thanks so much for the help so far.

Mime
View raw message