Using JSF HTML5 Friendly Markup with Other Component Libraries

Starting with JSF2.2, more elements can be written in HTML5: writing <button>

can be equivalent to writing <h:commandButton>

.

But how does this work with other component libraries? Is it possible to override this behavior and pass to a <button>

component from some library other than the standard / standard one (for example, <p:commandButton>

from simple ones)?

From the documentation I can see that a TagDecorator is required , but I don't see them anywhere. Is it because the perforiss hasn't yet implemented this feature or is it because JSF HTML5-friendly markup can only generate standard components ( http://xmlns.jcp.org/jsf/html

)?

+3


source to share


1 answer


As you can see in the TagDecorator page you linked to, the "html5 friendly" markup only applies to "basic" inputs, buttons, and links. PrimeFaces has a few analogies, but when you look at the real benefit of this "friendly html5" notation, it is mostly on the design side. Why..

Take a look at these 3 examples:



The first is html (5). But what 2 and 3 renders effectively on the client depends on (in this case) the joint implementation of the renderer (as seen in the tagDecorator page). What 1 render does depends on what PrimeFaces does. They could render <input type="number".../>

on the client side, but they could also do something more complex (like PrimeFaces does).

So what is the advantage of this makeup? Well, as I see it, this was a "counter action" for what all JavaScript frameworks and some other components like Tapestry have been promoting. So that you can use simple html for page design. This has only a limited benefit in my opinion. Many suitable types of ui components like data, trees, menus, tabs, etc. need a lot of javascript to work, adding classes in plain html and more to get closer to what the page will end up looking like and hence they don't look good in the designer since all this css and stuff is missing. The same is true for complex jsf components, they don’t bring any nice to the designer and you still need jsf tags for them. Thus,at the end you would mix simple html tags with their notation and "normal" jsf, a combination I tried and disliked (uniformity is good)

So, overall, I don't think it's strange that PF hasn't added TagHandlers to support this notation to its structure. I would prefer that they spend time and effort further improving their components.

+2


source







All Articles