Question

I'm trying to split my JSF2 pages into composite components. So I decided to put the composite components in a logical file tree. For example:

WebContent/resources/components/page1/component1.xhtml

The associated bean is in

Java resources/src/components/page1/component1.java

Its package is this components.page1.

In this example, component1.xhtml is found and rendered, but the bean is not found by the server.

If I don't use a subpackage:

WebContent/resources/page1/component1.xhtml
Java resources/src/page1/component1.java

So when the class is in the package page1, it works!

Is there a problem with composite component beans and subpackages?

I am using MyFaces 2.0, Tomcat 6 and Eclipse.

Was it helpful?

Solution

You need the componentType attribute of <cc:interface> to explicitly specify the backing component.

<cc:interface componentType="component1">

with

package components.page1;

@FacesComponent("component1")
public class Component1 extends UINamingContainer {
    // ...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top