hi steve, you are using different concepts here.
#1 @PageBean is just needed for enabling request-lifecycle callbacks like methods annotated with @PreRenderView (otherwise you don't need it) #2 (if needed) you can also do it the other way round (you can point from your bean to the view-config - see e.g. [1]) #3 you should never reference different page-beans for creating a menu - you can use e.g. a special bean for it (see e.g. [2]) regards, gerhard [1] https://cwiki.apache.org/confluence/display/EXTCDI/JSF+Usage#JSFUsage-Alternativeto@PageBean(sincev0.9.1) [2] http://code.google.com/a/apache-extras.org/p/myfaces-codi-examples/source/browse/community/src/main/java/org/apache/extras/myfaces/codi/examples/community/view/MenuBean.java http://www.irian.at Your JSF powerhouse - JSF Consulting, Development and Courses in English and German Professional Support for Apache MyFaces 2011/10/16 Steven Rudolf <steven.rud...@web.de> > Hello @all, > > I have another question concerning the typesafe navigation of CODI. > > I define my "view configuration" in several Pages-classes: > > @Page(navigation = Page.NavigationMode.REDIRECT) > public interface Pages extends ViewConfig > { > @Page > @UseCaseName("A") > @PageBean(UseCaseBeanA.class) > public class UseCaseA implements Pages {} > > // .. some more pages > } > > If I want to use this typesafe navigation in my view I have the problem, > that these configuration classes are not resolvable by the EL. So for every > PageBean I can implement a getPage-method in the PageBeans like this: > > @Named > @ViewAccessScoped > public class UseCaseBeanA > { > protected Class<? extends Pages> getPage() > { > return Pages.UseCaseA.class; > } > > // .. some more logic > } > > Now I can use it as an outcome for buttons: > > <h:button value="Use Case A" outcome="#{useCaseBeanA.page}" /> > > So I have two problems: > 1.) I think this design is error prone because of its duplicate > configuration: In the ViewConfig I define the @PageBean for a @Page and in > the getPage-method of the PageBean I define the Page for itself. > 2.) If I want to link to another page (via h:link or h:button), I have to > do it like I described before. If I do so, the Bean for the linked use case > will be instantiated immediately on the page which links to it. For one or > two pages it would be no problem but if I want to do it in the menu of my > application every use case bean will be initialized directly on the first > page (and the viewAccess-beans or conversation-beans will never be cleaned > up because the menu have a reference to them everytime). > > So is there an approach where I can use the ViewConfig directly in the > links or buttons in views? > > Sincerely, > Steve > > > >