Saturday, December 2, 2017

JSF facelets, composition, layouts, templates this is the Facelets documentation

and this is the ui:composition documentation


Let's admit it, HTML UI development is sheer mess.
In OOP you learn about nice encapsulation, separation of concerns, tidy APIs, design-time validation, convention over configuration... in HTML it's exactly the other way round, everything mixed up and it's just a verbose visually incomprehensible jungle, tons of implicit stuff has to be explicitly stated over and over, tons of useless boilerplate fluff make the code unreadable. It makes me really sick. With some better designed standard, the size of this crap could be reduced by a factor of 10 without any loss, actually gaining a lot in readability and maintainability. It's so evident.


Here a decent tutorial (a bit too complicated) on templates:

code is here:

in a JSF application you use a template, in which you insert contents defined in pages.

In a template, to insert the content, you use div+insert (=insertContent) ,

In a page, to use a template, you use composition (=useTemplate)

In a page, to define the content, you use define (=defineContent).

Again: a template inserts stuff; a page defines stuff and uses a template to arrange it on a layout.

for a page, look here

and the corresponding template is

No comments: