-
1. Re: Outjection problem. Sometimes evaluates to null
niox.nikospara.yahoo.com Feb 11, 2010 10:14 AM (in response to dish13)Hello,
I might be wrong, but if the component that @Outjects something is not created, the
something
will not be outjected! Make sure that the components do exist when the EL is called. As an alternative, you can use the factory pattern, implemented by Seam, that will ensure that the required outjectedthing
is always there.Unrelated to that, initializing a member field inline (i.e. @Out private Customer customer = new Customer();) has a side effect. When Seam creates the proxy object for your component, it will inevitably create an extra Customer. This is problematic if Customer is heavyweight or has side-effects. Initializing stuff in a constructor will result in the same potential proble.
It is much better to initialize member fields in @PostConstruct (or Seam's equivalent @Create) methods.
-
2. Re: Outjection problem. Sometimes evaluates to null
blabno Feb 11, 2010 12:53 PM (in response to dish13)This is very simple, but you follow wrong trail which confuses you.
Outjection happens after you call method on action bean. If you just enter the page (without page actions touching that action bean) then no outjection happens.The reason why you have Customer and not ServiceAddress is because Customer is seam component (i bet) and ServiceAddress is not. So even if there is no outjection, seam component gets instantiated if called by JSF.
-
3. Re: Outjection problem. Sometimes evaluates to null
dish13 Feb 15, 2010 3:38 AM (in response to dish13)Yes, I noticed that if I that problem occurred when I called the outjected property without calling the action bean before (probably because the bean is not instantiated).
Thank you.