[jboss-user] [JBoss Seam] - Re: Strange Outjection Problems

toni do-not-reply at jboss.com
Fri Feb 9 11:31:33 EST 2007


To reproduce the error I wrote the following:

Bean


  | 
  | @Name("test")
  | 
  | public class Test implements Serializable
  | {
  |   String text;
  | 
  | 
  |   public String getText()
  |   {
  |     return text;
  |   }
  | 
  |   public void setText(String text)
  |   {
  |     this.text = text;
  |   }
  | 
  |   public String toString()
  |   {
  |     return text;
  |   }
  | }

SFSB


  | @Stateful
  | @Name("testOutjection")
  | 
  | public class TestOutjection implements BasicTestOutjection
  | {
  |   @In(create = true)
  |   EntityManager entityManager;
  | 
  |   @Out(required = false)
  |   Test test;
  | 
  |   @Begin(join = true)
  |   public String outject()
  |   {
  |     test = new Test();
  |     test.setText("outject");
  |     return "test";
  |   }
  | 
  |   
  |   public String inject()
  |   {
  |     test.setText("inject");
  |     return "test";
  |   }
  | 
  | 
  |   @Destroy
  |   @Remove
  |   public void destroy()
  |   {
  | 
  |   }
  | }
  | 

JSF view

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
  | <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
  | <%@ taglib uri="http://jboss.com/products/seam/taglib" prefix="s" %>
  | 
  | <f:view>
  | 
  |   <h:panelGrid>
  | 
  |     <h:form>
  |       <s:validateAll>
  | 
  | 
  |         <h:commandButton type="submit" value="Outject" action="#{testOutjection.outject}"/>
  | 
  |         <h:commandButton type="submit" value="Inject" action="#{testOutjection.outject}"/>
  | 
  |       </s:validateAll>
  | 
  |     </h:form>
  | 
  |     <h:messages/>
  | 
  |   </h:panelGrid>
  | 
  | </f:view>

I used the seam.debug page to look at the conversation. The Test Bean never shows up.

I finally figured out why. Adding the following line to the @Out annotation will make it appear.

scope = ScopeType.CONVERSATION

Is that correct? Nowhere in my code I have been using this line, but I need it now. I think that it used to work well without it.

Arent seam components outjected into the default scop of the component from where they are outjected from? And isn't the default scope  CONVERSATION for SFSB?

If somebody can maybe briefly explain this and if it has changed between releases?


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

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



More information about the jboss-user mailing list