You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by J�r�me Iffrig <je...@hotmail.com> on 2007/06/20 23:08:09 UTC

get a Spring bean in one of my AJAX component (e.g. inputSuggestAjax)

Hi,

The following question may sound very specific and not really related to 
MyFaces, but it would help me answer a question I have troubles to formulate 
...

How can I access my Spring beans from the method defined as my 
suggestedItemsMethod method in a "s:inputSuggestAjax" component?

Note, if it helps, that I use jsf-spring as my glue between Spring and 
MyFaces. It works great, but not for such Ajax components...

Thanks

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


Re: get a Spring bean in one of my AJAX component (e.g. inputSuggestAjax)

Posted by Werner Punz <we...@gmail.com>.
Cagatay Civici schrieb:
> Hi,
> 
> Actually I prefer spring's builtin stuff for jsf integration and think
> of jsf-spring a bit unnecessary dependency.
> 
There were some issues in the Spring 1.0 integration, but with Spring
2.0 the included Spring - JSF bridge works like a charm. I used it
extensively in an orchestra based Project recently, and I had no issues
whatsoever.
JSF-Spring is not really needed anymore and probably causes more
problems than they solve.


Re: get a Spring bean in one of my AJAX component (e.g. inputSuggestAjax)

Posted by Cagatay Civici <ca...@gmail.com>.
Hi,

Actually I prefer spring's builtin stuff for jsf integration and think of
jsf-spring a bit unnecessary dependency.

Anyway you can try spring's FacesContextUtils;

http://www.springframework.org/docs/api/org/springframework/web/jsf/FacesContextUtils.html

Use as;

FacesContextUtils
     .getWebApplicationContext(FacesContext.getCurrentInstance())
     .getBean("sopranoBean");

Regards,

Cagatay

On 6/21/07, Jérôme Iffrig <je...@hotmail.com> wrote:
>
> Hi,
>
> The following question may sound very specific and not really related to
> MyFaces, but it would help me answer a question I have troubles to
> formulate
> ...
>
> How can I access my Spring beans from the method defined as my
> suggestedItemsMethod method in a "s:inputSuggestAjax" component?
>
> Note, if it helps, that I use jsf-spring as my glue between Spring and
> MyFaces. It works great, but not for such Ajax components...
>
> Thanks
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>