
Today I spent several hours to use the right scope with Primefaces and CDI/Weld. Finally I found this cool
blog of Steven Verborgh which describes how to create a view scope for CDI.
With this scope a backing bean keeps alive as long as the user stays on the same page/view.
I'd recommend using MyFaces CODI project. It (by default) enables the ViewScope to be supported in CDI.
AntwortenLöschenIn addition it contains more useful scopes (better @ConversationScoped, @WindowScoped, ...)
See:
http://github.com/matzew/codi-scope-sample
and:
https://cwiki.apache.org/confluence/display/EXTCDI/Documentation
(check out the child pages)