user2953119
user2953119

Reputation:

How to use composite component

I'm create mycomponent.xhtml in the root of Web Pages directory. In mycomponent.xhtml i describe some composite component

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:composite="http://java.sun.com/jsf/composite">
    <composite:interface/>
    <composite:implementation>
        ...
    </composite:implementation>
</html>

Now i'm creating facelet index.html in the root of Web Pages directory. But i cannot use mycomponent

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:mycomp="http://java.sun.com/jsf/composite">
         <mycomp:mycomponent/>      <!--Error, the component library composite does not contain mycomponent-->
</html>

Upvotes: 1

Views: 580

Answers (1)

skuntsel
skuntsel

Reputation: 11742

The composite component page (mycomponemt.xhtml) that you placed at the root must be located at /resources/mycomp folder: see composite components documentation for details.

You can find a kickoff example in Oracle's Java EE tutorial. Another one can be found in our composite component tag wiki.

Upvotes: 2

Related Questions