Reputation: 7415
In my JSF project I have a multi page wizard. I am using a @ConversationScoped
CDI bean for that wizard. The conversation works well. When user comes to the first page of the wizard, new conversation begins. When user clicks a submit button in any page, the conversation ends. But i have several questions.
Upvotes: 0
Views: 767
Reputation: 2435
Most applications ends up with some kind of system that tracks where the user is currently at. This is supposed to be helped by @FlowScoped in JSF 2.2. If you can use that instead then everything should be managed for you. It should be really easy to find examples.
If you can't use FlowScoped and want to stay on @ConversationScoped you must implement your own system for tracking where the user is at. When the user is no longer in your flow you end the conversation.
@Inject Conversation conversation;
// conversation.end();
Here is a useful part for implementing this: How to cleanly end a CDI @ConversationScoped
However I would go for http://deltaspike.apache.org/core.html and use: To get the conversation.
MyBean myBean = BeanProvider.getContextualReference(MyBean.class, false);
Personally I would do an extension to the type safe navigation in Deltaspikes JSF module to achieve the same thing if I could not use FlowScoped.
Good luck
Upvotes: 1