Hi,

I'm wondering if and how it is possible to let Seam instantiate a component B 
from a component A.

I have a component A - call it Manager - which is supposed to receive some data 
to create and persist a new entity. Therefore the Manager outjects a "blank 
entity" which is later injected with the data from the user. Some values are 
preset using a @Factory method in the Manager.

On the page the user sees to input his data, there is a drop-down menu, 
realised with s:selectItems which doesn't use the noSelectionLabel. Depending 
on the selected value some other values are set by the Manager. The drop-down 
menu gets its values from a component B - call it Selector. The current 
selected value is bijected in a third component - call it selectedValue - so 
that the Manager can adapt some values depending on the selectedValue.
Since there's no noSelectionLabel, i. e. the user has to choose a value, the 
@Create method of this Selector queries the database for some values and 
outjects the first one as selectedValue.

That works pretty good, but there's only one last thing to do: The first time 
the page is displayed, the @Factory method in Manager is invoked. And as you 
might guess the selectedValue is null. That's because the Selector is 
instantiated after the instantiation of the Manager since it occurs later on 
the page. But actually I want to preset some values depending on the 
selectedValue outjected by the @Create method of the Selector.

Is there a way to tell Seam to instantiate the Selector before the @Factory 
method of the Manager is invoked? One way would be to place a dummy call from 
the JSF page before the Manager is called. But that isn't a good design I 
think. Another way would be the usage of @Startup(depends). But actually I 
don't want to have both components instantiated before they are needed. Is 
there another way?

Thanks in advance
Newlukai

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4050027
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to