JSF and PrimeFaces Strategy

What is or could be best practice?

  • Using standard JSF components and combining them in PrimeFaces components, if necessary (for example, when DHTML or AJAX components are required)
  • Forget about all JSF components and try to use all PrimeFaces components as much as possible

Please explain this and tell me about your impressions.

Thanks in advance...

+4
source share
3 answers

PrimeFaces is your AJAX framework, so if you need to send an ayaxial request, use PrimeFaces components.

Although you do not need to send an ajax request, you can still use the PF component if you need to ensure the consistency of the search for your web page. For example, h:commandButton and p:commandButton . Use p:commandButton if you need to send an ajax request, but you can also do it

 <p:commandButton ajax="false" action="Your Action here"/> 

This will give the same result as:

 <h:commandButton action="Your Action here"/> 

but in this way you can provide a constant search for your button on the page.

There are no replacements in PrimeFaces for h:panelGrid , h:panelGroup , h:inputText , h:outputText ...

+9
source

Depends on a single functional requirement. If you are already using PrimeFaces, and everything you want to achieve is better / easier to achieve with the PrimeFaces component, use it.

Option 1 is close, but option 2 goes overboard. For example, PrimeFaces does not have <p:form> , <p:panelGroup> , <p:outputText> or anything else.

+6
source

With Primefaces, it’s very easy to get a consistent look at your application since it comes with Themeroller CSS platform. And you can easily switch projects. Although it’s easy to let simple jsf components look like price list components if you use the right css classes.

I think primefaces is a great component library. However, some components still do not work (for example, the date picker). Therefore, if you get some unexpected behavior with the primefaces component, it is always good to have a jsf reserve (or an alternative from another component library or from jquery).

I have no experience mixing different component libraries. It would be interesting to know how they interact. But this will be the subject of another question ...

+3
source

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


All Articles