Is the Facelets page created for the servlet as a JSP generated in Servlet

How all JSPs are generated / translated into Servlets before they are executed, is this true for Facelets?

I work with JSF 2.0 and Facelets and want to see its generated Java code, which may be Servlet.

+7
source share
2 answers

No, Facelets files are parsed in the XML tree using SAX parser . The XML tree is stored in the Facelet cache . The XML tree is at the time to see the build time turned into a UIComponent , which is accessible by FacesContext#getViewRoot() (which you can pass getChildren() at runtime). The component tree typically generates HTML using either the native encodeXxx() methods or those associated with the Renderer , starting with UIViewRoot#encodeAll() .

Facelets file files do not generate class files. XML trees are stored in server memory by default. Starting with JSF 2.1, you can specify FaceletCache using <facelet-cache-factory> in faces-config.xml , where you can write code to store the XML tree, for example, to a file system on disk (although this would be slower).

If you use <ui:debug> in the view and open it, you will see a text view of the component tree behind the UIViewRoot . See Also How to Debug JSF / EL

See also:

+13
source

Not really, it is cached. But it does not generate servlet code.

+1
source

All Articles