1

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 ?

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
user2590727
  • 441
  • 1
  • 6
  • 25

1 Answers1

4

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>

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555