-
1. Re: how to access one seam component in to another seam component
kragoth May 30, 2010 7:21 PM (in response to shwetank)Hi Shwetank,
Please take the time to read the Seam documentation. The question you are asking is talked about very early on in the documentation.
There are multiple ways to access a Seam component inside another Seam component.
The most common way to do this is using the '@In' annotation.
@Stateful @Name("eventBean") @Scope(ScopeType.CONVERSATION) public class EventBean implements DropListener ,EventBeanIn { @In(value="manageUserAction") //The value comes from the NAME of the other Seam Component private ManageUserAction mua; }
Another way you can do it is like this:
public void processDrop(DropEvent dropEvent) { ManageUserAction mua = Component.getInstance("manageUserAction"); }
Never use the
new
operation on a Seam bean. If you use the new operator on a Seam bean you will not get the benefits of the Seam infrastructure on that instance. (Events, transactions etc).But, ultimately, you really need to take the time to read the Seam documentation and look at the Seam examples provided in the /examples directory of the Seam download. It is always a good idea to at least read the documentation before posting on the forums. :)