I am confused and really hope someone can shed some light over my issue.
I have two beans:
Bean1 on session scope responsible for holding state.
Bean2 on event scope responsible for execution actions. Bean2 has a variable bean1 which is supposed to get Bean1 injected using @In annotation for each request.
On my facelet-page I basically have this:
<h:inputText value="bean1.value"/> <a4j:commandButton actionListener="bean2.action" value="submit"/>
What I thought would happen when the user clicks on the submit button is:
1. Bean1 is created and put on session scope
2. The value in input field is set in Bean1.value
3. Bean2 is created and put on event scope
4. Bean1 would get injected into Bean2
5. Bean2 can use the values on Bean1
But this did not happen, and when I debug I found that what appears to happen is that first one instance of Bean1 is created a assigned the value in the input field. Then when Bean2 is created another Bean1 object is created and injected into Bean2. I do not know why Seam does not use the first Bean1, and when I programatically try find the first Bean1 I cannot find it, at least not in event, page or session context.
So I have two question:
1. Is it supposed to be like this.
2. How do I get the first Bean1 to be put on session scope so my Bean2 can use it in the action method?