You should try Dialog Framework from Primefaces. It loads the content from an xhtml page in a dialog from the backing bean. Here are 2 links from primefaces showcase that will help you get started:
Basic - https://www.primefaces.org/showcase/ui/df/basic.xhtml