2 Replies Latest reply on Aug 7, 2009 8:52 PM by robertwalker

    help: simple pojo property not being updated (outjection and conversation)

    robertwalker


      Hi all, I am reading seam in action, and trying to use it as a tutorial for my app which has pages for a wizard.


      my issue is, i am not seeing my pojo being populated as I traverse the wizard. (I have outjected the pojo that contains properties which I am not seeing populated) and made the manager bean conversation scoped.


      my flow is this
      1) click a link to start a converssation (debug.seam confirms my manager bean: MailboxManager is in conversation ontext)



      <s:link action="#{mailboxManager.startWizard}" value="Start" />
      
      


      and mailboxManager has startWizard annotated like such


      // start a long running converstion
      @Begin(join=true)
      public String startWizard() {
              return "step1";
      }
      



      2) on the step1.xhtml page, I have a rich calendar which is mapped to my pojo's launchDate property


      <h:form>
           <rich:calendar popup="false"
                             value="#{mailboxBean.launchDate}" />
      




      3) my MailboxManager is


      @Name("mailboxManager") 
      @Scope(org.jboss.seam.ScopeType.CONVERSATION)
      public class MailboxManager implements Serializable 
      {
          @In(create=true)
          @Out
          private MailboxBean mailboxBean;
      




      4) When I traverse to the next step in the wizard, mailboxBean is never updated with value from step1. I put a breakpoint in my MailboxBean.setLaunchDate() but it never executes  :-(


      I know this is simple all, but I am struggling

        • 1. Re: help: simple pojo property not being updated (outjection and conversation)
          asookazian

          When you submit the form, the setLaunchDate() method will be executed prior to the action method in the h:commandButton or h:commandLink.


          In step 2, the value is referencing a Seam component that should have @Name("mailboxBean").  Does that annotation exist?  And if you're using SFSB rather than JavaBean, remember that the business method must be in your @Local interface, otherwise Seam won't find it.


          So if setLaunchDate() is in MailboxManager, then use mailboxManager rather than mailboxBean in step 2.

          • 2. Re: help: simple pojo property not being updated (outjection and conversation)
            robertwalker

            thanks for your reply, I am really excited about learning and using seam, just having some growing pains.


            I do understand about the setLaunchDate() being called prior
            to my action method being invoked.


            my goto step 2 is a s:link like this


            <s:link action="#{mailboxManager.step1}" propagation="join" value="next" />
            



            so prior to mailboxManager.step1()  being invoked, I expect
            mailboxBean.launchDate to be populated. I should not need to propagation attribute but i am trying different things to get this to work.


            my pojo bean to store the data across the wizard steps (step1.xhtml, step2.xhtml, step.xhtml) is annotated like you mentioned it should be.


            @Name("mailboxBean")
            public class MailboxBean implements Serializable {
            
                // components and properties for Step 1
                private Date launchDate;
            
                // components and properties for Step 2
                private String exchangeMailboxName;
            
                public String getExchangeMailboxName() {return exchangeMailboxName;}
                public void setExchangeMailboxName(String exchangeMailboxName) {this.exchangeMailboxName = exchangeMailboxName;}
            
                public Date getLaunchDate() {return launchDate;}
                public void setLaunchDate(Date launchDate) {
                    this.launchDate = launchDate;
                }
            



            thanks again, any other suggestions?