6 Replies Latest reply on Jan 3, 2007 4:22 PM by norman.richards

    When is outjection done?

      I had @Out on a property but then got a org.jboss.seam.RequiredException "Out attribute requires value for component". So I changed it to @Out(required=true) and the exception went away.

      Why did this exception come up when all I did was access the page for the first time? There was a property on the page bound to the @Out property of that bean, so I'm guessing that the bean had to have been instantiated on this first access.

      But I'm confused as to why the @Out required something to be outjected at that time as well...shouldn't outjection only occur after somebody does something on that page, such as clicking a button with an action bound to that bean? Otherwise when could you get away with @Out without required=true? Is @Out used with required=true most of the time, or without it?

      Thanks.

        • 1. Re: When is outjection done?
          echnaton

          i had the same error and i think i made it go away with required=false though this should only be important to the time when the variable is outjected.
          afaik outjection is done after invocation of a method of the component but it looks like it is outjected as well after the component has been created

          • 2. Re: When is outjection done?

             

            I had @Out on a property but then got a org.jboss.seam.RequiredException "Out attribute requires value for component". So I changed it to @Out(required=true) and the exception went away.


            Shouldn't it be changed to @Out(required = false) to get rid of the exception?

            required = true is default with @Out. Anytime the owning component is accessed, and requires an outjection, the assertion will be made. This can happen during invoke application (jsf request) or render phase (initializing a data model via @Factory)

            • 3. Re: When is outjection done?

              hstang, you're correct, I meant to say required=false in my original post.

              You said "anytime the owning component ... requires an outjection, the assertion will be made". When does it require outjection? You mentioned it's during invoke application or render phase, so is it correct for me to believe that it's only when an action method is accessed rather than just get/set a property upon first page access?

              • 4. Re: When is outjection done?

                I only know three phases off the top of my head(updatemodel, invoke application, and render phase), but I would imagine that for all 6 phases in JSF, if a Seam component is accessed and requires an outjection, then the assertion (be it false or true) will be made.

                action method (via h:commandButton) is part of the invoke application phase.
                get and set property happens during render phase and update model phases. So all those cases need to be taken to account

                • 5. Re: When is outjection done?

                  Well I'd imagine that required=false would be needed a LOT more often if outjection would be done after the first Seam phase...?

                  Anybody know with certainty about this issue?

                  • 6. Re: When is outjection done?

                    Outjection is done after any access to a component. The @Intercept annotation can limit this to only certain phases.