3 Replies Latest reply on Jul 22, 2010 8:14 AM by Herberson Silva

    New conversation starting on every method call

    philip puthenvila Newbie

      Hi
      I have extended the registartion example, I split this into 3 pages, first page have a link to start registration, then from the second page clicking button starts the conversation. then taking to the details page displaying all details entered.then clicking another button will take to the final page ,by clicking closw button on that page will end the conversation, this is theory, but in practical for each button click starts new conversation, my action class is plaing java class, and my User object is statfull ejb, is it needed that action class have to be ejb for Seam to work?
      Please share your thoughts
      Regards
      Philip

        • 1. Re: New conversation starting on every method call
          Herberson Silva Newbie

          How are you starting conversations?


          Post you action source-code so we can help you better.



          • 2. Re: New conversation starting on every method call
            philip puthenvila Newbie
            @Name("registerAction")
            @Scope(ScopeType.CONVERSATION)
            public class RegisterAction extends BaseAppSimpleAction {
            
                    /**
                     * 
                     */
                    private static final long        serialVersionUID        = 1L;
                    @In(create = true)
                    private UserLocal                        userEjb;
            
                    /**
                     * Default constructor.
                     */
                    public RegisterAction() {
                            // TODO Auto-generated constructor stub
                    }
            
                    @Validate
                    @Begin
                    public String callMyRegister() {
                            System.err.println("callMyRegister() userEjb " + userEjb.getName());
                            System.err.println("Conversation.instance() " + Conversation.instance().isLongRunning());
            
                            if (getErrorVec().isEmpty() && getWarningVec().isEmpty()) {
                                    return "success";
                            }
                            return "inValid";
                    }
                    
                    public String back() {
                            System.err.println("back() userEjb " + userEjb.getName());
                            System.err.println("Conversation.instance() " + Conversation.instance().isLongRunning());
                            return "back";
                    }
                    
                    public String save() {
                            System.err.println("save() userEjb " + userEjb.getName());
                            System.err.println("Conversation.instance() " + Conversation.instance().isLongRunning());
                            return "save";
                    }
            
                    @End
                    public String close() {
                            System.err.println("close() userEjb " + userEjb.getName());
                            System.err.println("Conversation.instance().getId(); " + Conversation.instance().isLongRunning());
                            return "close";
                    }
            
                    @Override
                    public IBaseBean getFormBean() {
                            return userEjb;
                    }
            
            }
            

            • 3. Re: New conversation starting on every method call
              Herberson Silva Newbie

              Try join your conversations, so your @Begin annotation will be something like @Begin(join=true).


              This way of begining a conversation ensure that the conversation will be joined (or merged) on begining of a new one.