Front Sides as JSP Template Templates

I really love the Facelets template model. On the other hand, there are many applications in which a simple JSTL in JSP is just fine, and JSF will be redundant.

Is it possible to use Facelets in pure JSP projects, i.e. there are no JSF dependencies of any type.

PS. I know that there is sitemesh, but still Facelets are very attractive to me.

+4
source share
1 answer

No, It is Immpossible. Facelets is not quite a template structure, but a completely different viewing technology and basically the successor to JSP. You can use them together in the same project when used separately, but you cannot use Facelets tags inside JSP files. Facelets is not a JSP tag library, but a single view technology like JSP. For example, Sitemesh is not a submission technology, but a JSP tag library that can be imported and used in JSP using <%@taglib%> .

If you want to use Facelets, you must completely replace the JSP files. Facelets can also be used without any necessary JSF managed beans, if you only have static views. Actually, this does not mean that you type too much code that you really need. So JSF being redundant is not an argument. All you have to do is put one javax-faces.jar file in /WEB-INF/lib . JSF 2.1 will automatically register in the servlet 3.0 container. You only need to declare the FacesServlet explicitly in web.xml whenever you want to use the *.xhtml URL *.xhtml (default patterns: /faces/* , *.faces and *.jsf ).

+4
source

Source: https://habr.com/ru/post/1390201/


All Articles