Let's say, that the MB wants to get user-details from a backend-service...
//The MB will ask for a user-service
UserService userService = factory.getUserService();
//and then will call the
UserDto userDetails = userService.getUserDetails(userId);
//and receive a VO/DTO containing all the UserDetails...
in the JSP the details then can be accessed "normally":
#{myManagedBean.userDetails.lastName}
and so on...
-----Original Message-----
From: Bj�rn T Johansen [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 24, 2005 7:04 PM
To: MyFaces Discussion
Subject: Re: Best practice?
But how to you fill the data in the MB from DAO?
Jesse Alexander (KBSA 21) wrote:
> Well we call the the Business-Layer from the managed beans, therefor we have
> no need to
> pass the MB to the backend...
> Alexander
>
> -----Original Message-----
> From: Bj�rn T Johansen [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 24, 2005 6:18 PM
> To: MyFaces Discussion
> Subject: Re: Best practice?
>
> Yes, that's what I was thinking about... But I am not sure if I should pass
> the managed
> bean just to my business layer and use VO from BO to DAO or just pass along
> the managed
> bean further on to the DAO.....
>
> BTJ
>
> Jesse Alexander (KBSA 21) wrote:
>
>>Hi Bj�rn
>>
>>In the project I am actually working on, we decided that our managed beans
>>cover
>>one usecase and therfor contain quite some logic and reducing the number of
>>"data-transfers" between mangaed beans... The actual business-logic is packed
>>within service-objects which are served by a factory and called from the
>>managed beans.
>>The service objects will then call the dao-layer or some other backend to do
>>persistence-work.
>>
>>Whether this is the "best practise"? I do not know, but it works (so far) for
>>our
>>project on which 4 people are working full time plus one JSF component
>>developer.
>>
>>hth
>>Alexander
>>
>>-----Original Message-----
>>From: Bj�rn T Johansen [mailto:[EMAIL PROTECTED]
>>Sent: Monday, May 23, 2005 8:52 AM
>>To: MyFaces Discussion
>>Subject: Best practice?
>>
>>I was wondering what's the best way of handling the following:
>>
>>- A managed bean need to be "filled" with data from a database using DAO
>>methods; is
>>it best just to pass the managed bean as parameter og should one use another
>>VO bean
>>and populate the managed bean from the VO bean?
>>
>>- when moving to a page, some fields need to be filled with existing values,
>>is this
>>best done in the action method that "calls" the new page and value binding
>>against a
>>managed bean for that page or is there another better way of doing this?
>>
>>
>>Regards,
>>
>>BTJ
>>