0

Someone today tried to convince me that Facelets are built on top of Servlet API. Knowing that Facelets unlike JSP are never compiled to actual servlet Java classes, I'm wondering how that could be possible. If this happens then at what stage Servlet API abstract classes and interfaces get implemented?

mmierins
  • 3,674
  • 4
  • 21
  • 25

2 Answers2

1

Do you know the difference between API and implementation? The Servlet API may be full of abstract classes and interfaces, but the servlet implementation is not.

JSF has a FacesServlet which processes JSF related things, so yeah it's definitely built on top of the Servlet API.

Note that Facelets is actually the advanced templating system used with JSF (instead of using JSP), so I wouldn't say that Facelets is built on top of Servlets, but JSF is.

Kayaman
  • 72,141
  • 5
  • 83
  • 121
  • Yes, I know the difference between API and implementation. The phrasing of the question was misleading. My point was that if Facelets are built on top of Servlet API at some point there would be necessity to extend those abstract classes or implement specific interfaces. My question is - does this really happen and if yes - at what stage and what is the process? – mmierins May 27 '14 at 09:29
  • A Servlet implementation implements the Servlet API. As it has done for years, even before JSF was thought of. – Kayaman May 27 '14 at 10:53
1

The facelets aren't compiled to a Servlet or any other Java class instance. They are converted to a XML tree, which is then stored in an instance of the FaceletCache class.

More info:

Community
  • 1
  • 1
Konstantin Yovkov
  • 62,134
  • 8
  • 100
  • 147