You might as well read the thread "Providing spring-like InitializingBean interface for JSF managed beans" on 28-10-2005
Martin Marinschek wrote:
Look at Craig's struts-shale.

It's an add on library for JSF that provides features like this.

regards,

Martin

On 10/30/05, Yee CN <[EMAIL PROTECTED]> wrote:

Hi,



I am having problem finding a solution for a simple task that I have done a
hundred times in ASP.NET. Let me illustrate a scenario:



Backing bean: UserBean

The bean is to have an init() method which looks for the request parameter
"userId", loads the user for display in viewUser.jsf.

It makes use of UserService to load the user from database. The UserService
is injected by Spring.



The problem:

The logical place to call init() is in UserBean constructor – but Spring
does not inject UserService until AFTER the bean is constructed. So the
constructor is out.



Where else could I do it? At the setUserService setter method? That would
work – however what if I need Spring to inject more than 1 object, which
setter should I place init()? This approach is down right ugly anyway.



Do I need to implement phase listener (I do not fully understand how that
works yet)?



Am I missing something? Or is something missing in JSF?



Many thanks in advance.



Regards,

Yee




--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German

Reply via email to