2 Replies Latest reply on Apr 3, 2006 1:45 PM by Gavin King

    scope confusion

    eekboom Newbie

      Ok, I understand contexts and their usefulness.

      What I do not understand is why "scope" parameters are needed on @In and @Out annotations!

      The scope of a context variable is already fixed when declaring it with @Name/@Scope or with @Role, right?

      So what's the advantage of being able to specify the scope when the context variable is used? Isn't it actually an error if you declare
      @Role(name = "foo", scope = SESSION)
      but then use
      @In(name="foo", scope = PAGE)

      Is it only to allow the two different context variable with the same name in two different scopes? (I would never want to do that, do I?)

      The doc does not mention "scope" in the "annotations for bijection" section. In fact I actually searched the complete document and none of the examples uses the scope parameter.

        • 1. Re: scope confusion
          eekboom Newbie

          A related question: Can you use @Out to introduce a context variable that is not declared by any @Name or @Role annotation?

          • 2. Re: scope confusion
            Gavin King Master

            scope is almost always NOT needed on @In or @Out.

            If the thing being outjected is a Seam component, Seam can deduce the scope from the component type.

            But when we are outjecting a String or a List, it is not a Seam component, so we need to explicitly specify the scope.

            And yes, that is how @Out can be used to set a context variable with no corresponding Seam component.