5 Replies Latest reply on Mar 30, 2007 9:24 AM by fhh

    2 questions about Seam

    Stateless Bean Novice

      Hi,
      1. If i got simple public class in seam how seam use it?
      Is this similar to SSSB/SFSB?

      2. If i declare in one SFSB variable like

      @Out
      private Long var;

      and in another SFSB i get those variable:

      @In
      private Long var;

      i got 2 instances of var or still one?

        • 1. Re: 2 questions about Seam
          Denis Karpov Newbie

          Second question

          @Out @In works with contexts.

          @Out
          private String hotel;
          The @Out annotation declares that an attribute value is outjected to a context variable after method invocations. In this case, the context variable named hotel will be set to the value of the hotel instance variable after every action listener invocation completes. (C)Seam Reference.

          The key point for understanding, that injection and outjection occurs on each invocation of an any method of this bean, that was made as action listener invocation. If you just call method from java code there will be no in/outjection.

          And also be aware with what contexts you are working.

          • 2. Re: 2 questions about Seam
            Wayne Bagguley Newbie

            The variable (e.g. var) will belong (scoped) to the SFSB it is declared in but it will be outjected or injected to/from the relevant context. I don't think you can rely on it being the same object (it might well be) but it should have the same value.

            • 3. Re: 2 questions about Seam
              fhh Expert

               


              The key point for understanding, that injection and outjection occurs on each invocation of an any method of this bean, that was made as action listener invocation. If you just call method from java code there will be no in/outjection.


              Is that true? I thought that Seam will intercept any access to a scoped bean but I have never bothered to check.

              Regards

              Felix

              • 4. Re: 2 questions about Seam
                Pete Muir Master

                You need to instantiate the bean using seam (i.e. @In(create=true), or some sort of auto creation), and not just via new Foo()

                • 5. Re: 2 questions about Seam
                  fhh Expert

                  That was my understanding. (That's what I meant when I said it had to be scoped).


                  Thanks!

                  Felix