4 Replies Latest reply on May 18, 2007 2:15 AM by moshe1

    Component Scope

    moshe1

      Is there any way I can scope or reference a seam component so that it can be included more than once in a page? i.e same component different instances?

        • 1. Re: Component Scope
          fernando_jmt

          Yes, you can. See @Role and @Roles in the seam reference documentation.

          • 2. Re: Component Scope
            moshe1

            is there any way besides for having to create a new role every time I use the component?

            • 3. Re: Component Scope
              stu2

              Seam components are scoped variables, where each scope is essentially a map. So if I understand correctly, what you're asking is on a par with asking "can I put two items into the HttpRequest and give them both the same name?" So no, I don't think that'd work.

              However you can certainly create your own composite objects, and expose those however you'd like.

              Could you give a specific example of what it is you're trying to do? I'm sure folks on the list will help you find a good way to do it using seam.

              • 4. Re: Component Scope
                moshe1

                I want to create general componenets using facelets
                e.g selectUser, selectGroup, selectDocument that will be reused in multiple places

                I could use a stateless bean and just pass in all state variables (e.g. current search criteria) and value variables (that userId selected)

                I just wanted to know if there is a cleaner solution using seam, (if not I will ad d a feature request)