6 Replies Latest reply on Dec 28, 2008 8:43 PM by Nikolai Gagov

    Outjecting values after some action, not at component creation time

    Mario Scalas Newbie

      I am trying to build a wizard (several pages in same conversation): for each page I have a backing bean (bean1) which (in my design) should outject the collected values so that following bean (bean2) can @In and use them.


      So I wrote:


      @Name( "bean1" ) Scope( CONVERSATION )
      public Bean1 {
         @Out Item item;
      
         public String next() {
            // Find item
            return "ok";
         }
      }




      This does not work because SEAM wants item to be not null at instantiation time while I mean to say to SEAM that after the user presses next you can outject the value in "item" field. If I use @Out( required = false ) then SEAM just does not outject nothing ...


      So far I have resorted to explictly put the instance in the context, something like:


      @Name( "bean1" ) Scope( CONVERSATION )
      public Bean1 {
         public String next() {
            // Find item
            Contexts.getConversationContext().set( "item", item );
            return "ok";
         }
      }



      Which works ok but makes me think. Any ideas?