1 Reply Latest reply on Oct 23, 2007 10:06 AM by Samuel Mendenhall

    How to outject without @Out annotation

    Sean Burns Newbie


      I see there is a way to inject by using Componenet.getInsance.
      Is there a way to outject a object with out using the annotation?



        • 1. Re: How to outject without @Out annotation
          Samuel Mendenhall Apprentice

          You can look up the component and automatically create it if it doesn't exist like:
          MyBean myBean = Component.getInstance("myBean", true);

          Then set it to whichever context you want via:
          Contexts.getSessionContext().set("myBean", myBean);

          The above is not a perfect example, because if the myBean is ScopeType.SESSION, there is no reason to set it again in the Session context.