Loading page content via AJAX in JSF2
-
12-12-2019 - |
Question
I've been looking into jsf technologies lately such as primefaces, primefaces-extensions, omnifaces .
what I am not able to find is way to fetch content via ajax for example load a form, table content and put them into div or something, I've looked at rendered
attribute, but that won't work for high scale application.
Any help would be appreciated.
Solution
A handy trick for this is using a dynamic ui:include tag like:
<div id="dynamicContent">
<ui:include src="#{contentBean.content1}"/>
</div>
Where content1 is a string with path and .xhtml filename (usually something like /WEB-INF/content/page1.xhtml), and the parent div can be used to update.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow