[jboss-user] [JBoss Seam] - Re: Injection / Outjection

mikepkp17 do-not-reply at jboss.com
Fri Jan 5 04:57:35 EST 2007


I want to point out what problem I had to clarify this issue for others.

For the navigation component in my webapp i had a SFSB TabBean. This bean contained a Vector with TabItem objects.
In my jsf code I called the TabBean to return all TabItems like that:


  | <c:forEach var="tab" items="#{tabBean.tabs}">
  | 

and for each tab I generated a 


  | <h:commandLink value="#{messages[tab.name]}" action="#{tab.getNavigationAction}" />
  | 

When my application is running and I click on such a commandLink, tab.getNavigationAction is called on the according TabItem object.

This method did two things. It returns the navigation string where to go to. Now the problematic thing. 

Each TabItem stores a reference to the TabBean. If TabItem.getNavigationAction is called then this method calls tabBean.setActiveTab(this). setActiveTab then calls sessionBean.setActiveTab(...) where sessionBean is set via @In(create=true) in TabBean. In my case sessionBean was always null. This is because the Bijection mechanism seems to only work if a beans method is called from jsf and in my case the beans method was called from another bean.

Call to bean method from jsf:
The BijectionInterceptor first injects the object, then calls the bean method, then outjects if necessary and after that disinjects the injected object (sets it to null). 

Call to bean method from another bean (which is called from jsf):
The BijectionInterceptor injects the object correctly, then invocation.proceed() has no effect since the invocation is not from jsf, then outjection should occur, after that the object is disinjected. And after that the beans method is invoked (and the injected object is null because is already disinjected...)

pfuhh...

I hope you understand my findings...

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

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



More information about the jboss-user mailing list