2013-11-29 2 views
0

Я создаю mycomponent.xhtml в корне каталога Web Pages. В mycomponent.xhtml я опишу некоторые Составной компонентКак использовать составной компонент

<?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> 

Теперь я создаю facelet index.html в корне Web Pages каталога. Но я не могу использовать 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> 

ответ

1

Композитной страницы компоненты (mycomponemt.xhtml), помещенной в корне должен находиться в папке /resources/mycomp: см composite components documentation для деталей.

Вы можете найти пример запуска в Oracle's Java EE tutorial. Еще один из них можно найти в нашем composite component tag wiki.

+0

Другое можно найти в нашем теге wiki http://stackoverflow.com/tags/composite-component/info – BalusC