Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[JSF - Spring] How to inject a bean Spring in Converter JSF

843842May 10 2006 — edited Sep 4 2008
Hello,

I'm writing a converter for my JSF webapp; my class implements the Converter interface and the boths methods getAsObject and getAsString.

For the method getAsObject, I need a manager of my Service layer.
I added an attribute "manager" in my Converter class and a setter.

I use Spring IoC; so my Manager object is a bean declared in my ApplicationContext.xml file.

In my faces-config.xml, I declared the element:

<application> <variable-resolver> org.springframework.web.jsf.DelegatingVariableResolver </variable-resolver> <locale-config/> </application>

I have a problem now: I do not know how to make to state my converter in order to inject my bean Manager to him.
I have for the moment tested that:
<converter> 
   <converter-id>MyConverter</converter-id>     
   <converter-class>com.jsf.MyConverter</converter-class> 
   <property> 
      <property-name>mgr</property-name> 
      <property-class>com.service. Manager</property-class> 
      <suggested-value># {manager} </suggested-value> 
   </property>
</converter>
and that does not go, mgr in the MonConverter object is null.
I checked if the setter of the manager in the MonConverter class were called, and it is it. However, the parameter of the setter is null.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2008
Added on May 10 2006
22 comments
1,345 views