Why Facelets not JSP?

  • templating and composite components


The main benefit of using Facelets over JSF is that Facelets supports code reuse through templating and composite components.


The example below shows how the address.xhtml template is used in the useraddresses.xhmtl file. A user has a mailing address and a shipping address. The address.xhtml is used twice in the useraddresses.xhtml. The big difference between Facelets template and JSP include is that you can pass object parameters from the including file to the template in Facelets and you can’t do that from JSP including file.