OK, just looked again at your original code. 

I think what you are trying to do is something like this:

@Name("myBean")
  | @Scope(ScopeType.CONVERSATION)
  | public class MyBean {
  | 
  |      private String theValueThatShouldBeSeenInTheForm;
  | 
  |      public void setTheValueThatShouldBeSeenInTheForm(String str) {
  |           theValueThatShouldBeSeenInTheForm = str;
  |      }
  | 
  |      public String getTheValueThatShouldBeSeenInTheForm() {
  |           return theValueThatShouldBeSeenInTheForm;
  |      }
  | }

@Stateful
  | @Name("myController")
  | public class Controller {
  | 
  |         @In(value="myBean", required=false)
  |     protected MyBean myBean;
  | 
  |         /**
  |          * begin conversation
  |          **/
  |         @Begin
  |         @Factory("myBean")
  |         public void init() {
  |                 myBean = Component.newInstance("myBean");
  |             myBean.setTheValueThatShouldBeSeenInTheForm("Hello World");
  |     }
  | 
  |         /**
  |          * just do any conversation-logic
  |          **/
  |         public void doAnythingAction() {
  |                ...
  |         }
  |         
  |         /**
  |          * finish conversation
  |          **/
  |         @End
  |         public void doEndConversationAction() {
  |                ...
  |         }
  | }

But do you see how this simply doesn't make any sense?

If you *always* want to run this initialization every time a page references 
myBean, then you can just do the initialization in an @Create @Begin method of 
myBean. You don't need to do it in the controller at all.

If, on the other hand, this is controller-specific initialization, just do it 
in an @Create @Begin method of the controller and make sure your page 
references myController somewhere, to force creation of the controller. This 
way, it will have nothing at all to do with @Create or @Factory methods for 
myBean.



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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to