简体   繁体   English

如何使用复合组件

[英]How to use composite component

I'm create mycomponent.xhtml in the root of Web Pages directory. 我在Web Pages目录的根目录中创建mycomponent.xhtml In mycomponent.xhtml i describe some composite component 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>

Now i'm creating facelet index.html in the root of Web Pages directory. 现在,我在Web Pages目录的根目录中创建facelet index.html But i cannot use mycomponent 但是我不能使用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>

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. 您放置在根目录下的复合组件页面(mycomponemt.xhtml) 必须位于/resources/mycomp文件夹 :有关详细信息,请参见复合组件文档

You can find a kickoff example in Oracle's Java EE tutorial . 您可以在Oracle的Java EE教程中找到启动示例。 Another one can be found in our composite component tag wiki . 另一个可以在我们的复合组件标签Wiki中找到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM