Reputation: 489
I would like to override a primefaces component class. So, I have registered the component class in faces-config.xml of WAR project.
<component>
<component-type>org.primefaces.component.dnd.Droppable</component-type>
<component-class>com.******.****.****.component.CustomDroppable</component-class>
</component>
This is my new test class:
public class CustomDroppable extends Droppable{
@Override
public void queueEvent(FacesEvent event) {
System.out.print("fffffffffffff");
}
}
The application was built anew, but it uses the old class. Why ? What else should I do ?
Upvotes: 1
Views: 2704
Reputation: 1108632
In the <component-type>
, you should specify the component type, not the component class. The component type does not necessarily resemble a Java FQN, it can be any kind of string you want. Usually, you can find the right component type in the API documentation of the component class you'd like to replace.
In case of org.primefaces.component.dnd.Droppable
class, it's defined as constant field COMPONENT_TYPE
whose value is org.primefaces.component.Droppable
(thus, without dnd
"subpackage" as compared to the component class).
Fix it accordingly:
<component>
<component-type>org.primefaces.component.Droppable</component-type>
<component-class>...</component-class>
</component>
Upvotes: 4