开发者

Can someone explain facelets?

开发者 https://www.devze.com 2022-12-29 02:41 出处:网络
I have been involved in JSF + Facelets dev for a month or so. I used composition, insert, define and other tags from facelets. I am finding it difficult to understand what facelets really give me? Wha

I have been involved in JSF + Facelets dev for a month or so. I used composition, insert, define and other tags from facelets. I am finding it difficult to understand what facelets really give me? What are its alternatives ? What is that View Handler technology?I am not able to find good material / online notes on the same. Can someone explain in laymen terms - What it is? Tha开发者_如何学Cnks


Facelets is a view technology. Facelets is the successor of JSP. The only alternative as far is JSP, which has almost no seamless support for JSF components. If you leave Facelets aside and step back to JSP, then the real advantages of Facelets will be quickly clear.

You may find my answer in the question useful as well: What is the difference between JSF, Servlet and JSP? Facelets is also covered in there.


Without providing a complete academic background on Facelets, here's what it really gives you:

  1. First, the ability to create reusable HTML code that you write yourself: this is not possible with JSF (pre-v2). Facelets gives you more control over the output of your webpages.
    • It has been demonstrated in some editors you can preview parts of your page this way as well, but in reality this is impractical as the webpage has many states of which only the initial bare version would be visible in the preview.
    • If you are going to use JSF for a public website, Facelets are a must for SEO, considering that with JSF you have no control whatsoever of what comes out of the standard JSF components.
  2. Second: templating. The ability to define blocks of HTML (read: Facelet compositions) that can be reused using tags such as ui:define and ui:insert.

There are other benefits, but right now you should know that these two are why you are using Facelets over JSF. Also, JSF 2.0 by default contains a modified version of Facelets.

benefits of facelets: http://www.ibm.com/developerworks/java/library/j-facelets/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号