Yes it is possible.
You do not need to have a Java compiler to render the view. Facelets is fully controlled by taglib, there can only be EL (expression language) in a script template, so nothing needs to be statically compiled.
To insert Facelets into a standalone application, you can programmatically initialize the servlet context. In this case, I am using Jetty. See the implementation of the ServletTester class and write your own server.
It is useful to note that jsf-ri does not work very well, however, fortunately, we have a different choice, we can use myfaces-impl , which works better.
The main problem is ResourceResolver . If you need to configure a complex resource structure, i.e. Template files (xhtml) are located in different places, you need to:
Create your ResourceResolver delegates to DefaultResourceResolver .
Override org.mortbay.jetty.servlet.Context.getResource() so that it returns matched resources using ResourceResolver . Or similar, if the built-in servlet context is not based on Jetty.
source share