Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
625 views
in Technique[技术] by (71.8m points)

<my:foo> Tag Library supports namespace: http://java.sun.com/jsf/composite/mycomponents, but no tag was defined for name: foo

I have a composite component named <my:foo> and I'm building another composite component named <my:bar>. But when I attempt to use <my:foo> inside the <cc:implementation> of <my:bar>, the following exception is been thrown:

<my:foo> Tag Library supports namespace: http://java.sun.com/jsf/composite/mycomponents, but no tag was defined for name: foo

How is this caused and how can I solve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is caused by a bug which was introduced in Mojarra 2.1.8, continued in 2.1.9 and is fixed in 2.1.10. This bug causes that composite component's own XML namespace cannot be declared in a root XML element like <ui:component>/<ui:composition>/<html>/etc as follows:

<ui:component 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:cc="http://java.sun.com/jsf/composite"
    xmlns:my="http://java.sun.com/jsf/composite/mycomponents"
>
    <cc:interface>
        ...
    </cc:interface>
    <cc:implementation>
        <my:foo />
    </cc:implementation>
</ui:component>

This would result in the following exception when you attempt to nest <my:foo> inside the <cc:implementation>.

<my:foo> Tag Library supports namespace: http://java.sun.com/jsf/composite/mycomponents, but no tag was defined for name: foo

The current workaround, apart from downgrading to 2.1.7 and waiting for 2.1.10 to be released, is to move the XML namespace declaration into the <cc:implementation>.

<ui:component 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:cc="http://java.sun.com/jsf/composite"
>
    <cc:interface>
        ...
    </cc:interface>
    <cc:implementation xmlns:my="http://java.sun.com/jsf/composite/mycomponents">
        <my:foo />
    </cc:implementation>
</ui:component>

See also:


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...