I am using PrimeFaces UI library for my web UI project.
I have a manage_watchfolder.xhtml page that has a button, and this button launches a dialog:
<p:commandButton value="Add" oncomplete="dlgEditWF.show()"
update=":editWFForm" process="@none"/>
Inside this same file I have dlgEditWF included from edit_watchfolder.xhtml:
<p:dialog id="editDialog" widgetVar="dlgEditWF" modal="true"
resizable="true" onShow="showHideActionLocation();">
<ui:include src="edit/edit_watchfolder.xhtml"/>
</p:dialog>
The problem is that I do not want edit_watchfolder.xhtml to be loaded before the button is clicked. However, edit_watchfolder.xhtml is "loaded" at the same moment manage_watchfolder.xhtml is created. So, all the beans called from edit_watchfolder.xhtml are created, initialized, etc, even user maybe will never actually click on the button. This creates a lot of overhead, and makes execution slow.
Can I avoid this?