Facelets - how does it actually work?


Web tier: servlets, JSP, Web frameworks: Facelets - how does it actually work?

  1. Facelets - how does it actually work? (1 messages)

    I'm slightly confused - is Facelets implemented by servlets? For JSP, the process is something like: write JSP, with tags -> compile JSP to servlet -> servlet runs in server So for Facelets: write XHTML, with ui components -> compile to JSF component tree / servlet? -> servlet runs in server At first I thought that the XHTML was compiled to a JSP, but that would defeat the point of Facelets. If anyone has any pointers to any resources that explain this, much appreciated! I'd like to see a diagram that shows the extra Facelets steps and how they sit with the JSF lifecycle. I found the explanation in the Facelets Developer Documentation a little hard to follow... Thanks Nick
  2. Having done some further digging around, I think I can answer this question: What I hadn't realised was that JSF has its own Servlet (e.g. in MyFaces, FacesServlet implements Servlet). Facelets compiles the XHTML (or XML) markup into it's own format called a 'Facelet'. The Facelet acts as a set of instructions for building the JSF component tree. Facelets do not relate to JSP at all. So the deployed application consists of the component tree and a Servlet (i.e. a FacesServlet if you're using MyFaces) to handle requests. Hope this is useful to someone else... Nick PS Thanks Jacob! ;-)