I am trying to ajax-refresh the main-content from navigation menu.
The requirement is exactly the same in the link
How to ajax-refresh dynamic include content by navigation menu? (JSF SPA)
following the pattern answered by BalusC,
<h:panelGroup id="content" layout="block">
<h:form id="contentform">
<h:panelGroup rendered="#{bean.page == 'include1'}">
<ui:include src="include1.xhtml" />
</h:panelGroup>
<h:panelGroup rendered="#{bean.page == 'include2'}">
<ui:include src="include2.xhtml" />
</h:panelGroup>
<h:panelGroup rendered="#{bean.page == 'include3'}">
<ui:include src="include3.xhtml" />
</h:panelGroup>
</h:form>
Each xhtml has its own managed bean with @PostConstruct method, the problem is all the @PostConstruct method gets called irrespective of rendered condition.