[jboss-user] [JBoss Seam] - Injecting several beans of the same type/kind/class

toni do-not-reply at jboss.com
Wed Mar 21 13:43:57 EDT 2007


is it possible to reference several entity beans of the same type from a JSF page without adding anything to the faces-config.xml?

So that if I have the bean class EmailAddress I could simply write in my JSF page the following code:

<h:inputText value="#{emailAddress}"/>
<h:inputText value="#{emailAddress2}"/>
<h:inputText value="#{emailAddress3}"/>

I defined them in a SFSB as follows:

public class EmailActionBean implements EmailAction
  @In(create = true)
  EntityManager entityManager;

  @In(create = true)
  EmailAddress emailAddress;

  @In(create = true)
  EmailAddress emailAddress2;

  @In(create = true)
  EmailAddress emailAddress3;

Does seam automatically create the three instances, when the JSF page is called and even so no method of the SFSB has been invoked yet?

I thought that the JSP page only can reference the other two entity beans, once the SFSB has been invoke in some way.

However, the first bean seams to be always ready, because it's name matches it's class name (in bean style).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4030329#4030329

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4030329

More information about the jboss-user mailing list