Reputation: 6136
I am very fond of the Facelets templating model. On the other hand there are many applications where plain old JSTL in JSPs is just fine and JSF would be an overkill.
Is it possible to use Facelets in pure JSP projects, that is no JSF dependencies of any kind.
PS. I know there is sitemesh, but still Facelets are very appealing to me.
Upvotes: 4
Views: 329
Reputation: 1109532
No, this is not possible. Facelets is not exactly a templating framework, but an entirely distinct view technology and basically the successor of JSP. You can use them together in a single project when used separately, but you cannot use Facelets tags inside JSP files. Facelets is not a JSP tag library, but a whole view technology at its own like as JSP is. Sitemesh for example is not a view technology, but a JSP tag library which can thus be imported and used in JSP by <%@taglib%>
.
If you want to use Facelets, you've got to replace the JSP files altogether. Facelets can also be used without any necessary JSF managed beans if you have only static views. There's not really a means of overkill as long as you write exactly the code you really need. So JSF being a overkill is a non-argument. All you need to do is to put one javax-faces.jar
file in /WEB-INF/lib
. JSF 2.1 will auto-register itself on a servlet 3.0 container. You only need to declare the FacesServlet
explicitly in web.xml
whenever you want to use the *.xhtml
URL pattern (the default patterns are /faces/*
, *.faces
and *.jsf
).
Upvotes: 4