I use Primefaces 5.x (on myFaces 2.2.x) for my UI and I want to disable / deactivate some JSF tags like to avoid mistakes.
Is there a blacklist or whitelist I can use?
There's no such thing in standard JSF/PrimeFaces API.
Quick'n'dirty workaround would be overriding the component registration in webapp's faces-config.xml
whereby you set the component class to a non-UIComponent
class (it will ultimately throw ClassCastException
on usage), or to a custom UIComponent
which throws e.g. IllegalArgumentException
in its constructor.
E.g. if you'd like to avoid usage of <p:selectOneMenu>
component which has a component type of org.primefaces.component.SelectOneMenu
:
<component>
<component-type>org.primefaces.component.SelectOneMenu</component-type>
<component-class>java.lang.Object</component-class>
</component>
An alternative would be to manually visit the component tree after it's being built and check every single component class against a white/black list in a Set<Class<UIComponent>>
.
A more clean alternative would be to override Application#createComponent()
to check the component type against a white/black list.
Yet another alternative would be to edit the PrimeFaces taglib/config XML to remove the undesired components and rebuild the JAR.