Hello Weld Users,
I have a question about conversation, how it works...
I have 2 beans:
@Named @ConversationScoped public class SearchBean implements Search, Serializable { ... @PostConstruct private void init() { logger.info("init search bean"); } @Override public void search(ActionEvent event) { if (conversation.isTransient()) { conversation.begin(); } service.search(this.otherEvent); } ... }
@Named @ConversationScoped public class ControlBean implements Search, Serializable { ... @PostConstruct private void init() { logger.info("init control bean"); } public void openDetail(ActionEvent event) { logger.info("openDetail"); messages.info("openDetail"); } ... }
and 1 page with 2 forms:
<h:form id="form1"> ... <h:commandButton value="#{msg['lbl.btn.find']}" actionListener="#{searchBean.search}"> <f:ajax render="@form" execute="@form"/> </h:commandButton> ... </h:form> <br/> <h:form id="form2"> ... <h:commandButton value="#{msg['lbl.btn.oped.detail']}" actionListener="#{controlBean.search}"> <f:ajax render="@form" execute="@form"/> </h:commandButton> ... </h:form>
I would now expect that both beans wont initialize until I end the conversation!
But the problem is that after hitting opendetail the init control bean is executed, like it would not know about the conversation.
The problem disappears if the whole page has only one form:both beans are in the same form.