嵌套复合组件在JBoss 7.1.1中被破坏

Xav*_*ois 4 composite-component jsf-2 jboss7.x

我们在项目的其他组件中使用复合组件.在JBoss 7.1.0上一切正常,但在JBoss 7.1.1上,我们得到如下错误:

No handlers found for exception javax.faces.view.facelets.TagException: 
/resources/components/my/bigComponent.xhtml @21,47 <my:nestedComponent> 
Tag Library supports namespace: http://java.sun.com/jsf/composite/components/my, 
but no tag was defined for name: nestedComponent
Run Code Online (Sandbox Code Playgroud)

我们尝试了这个JBoss社区线程中提出的解决方案,但它没有改变我们的问题(在这种情况下接缝我们不是唯一的,并且解决方案可能不起作用,因为我们也在ui:define模板文件的标签中) .

这是我们的两个组成部

嵌套:

<!DOCTYPE html PUBLIC ...>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:cc="http://java.sun.com/jsf/composite"
  xmlns:my="http://java.sun.com/jsf/composite/components/my" >

<cc:interface componentType="...">
    <h:panelGroup>
        <cc:attribute name="someAttribute" />
    </h:panelGroup>
</cc:interface>

<cc:implementation>
     <my:nestedComponent content="a text" />
</cc:implementation>
</html>
Run Code Online (Sandbox Code Playgroud)

嵌套:

<!DOCTYPE html PUBLIC ...>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:cc="http://java.sun.com/jsf/composite">

<cc:interface>
    <cc:attribute name="content" />
</cc:interface>

<cc:implementation>
    <h:outputText value="#{cc.attrs.content}" />
</cc:implementation>

</html>
Run Code Online (Sandbox Code Playgroud)

这是回归吗?我们做错了吗?在第一个链接中,建议的解决方案在嵌套组件中暗示如下:

<composite:interface>
    <composite:facet name="greet1"/>
    <composite:facet name="greet2"/>
</composite:interface>
<composite:implementation>
    <lib:greet1 name="Stan" />
    <lib:greet2 name="Silvert" />
</composite:implementation>
Run Code Online (Sandbox Code Playgroud)

什么是composite:facet没有任何东西composite:renderFacet

Xav*_*ois 9

Valentinx在这个帖子中找到了一个解决方法.

这个想法是将错误的命名空间声明放在<composite:implementation>自身上,所以

<!DOCTYPE html PUBLIC ...>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:cc="http://java.sun.com/jsf/composite"
  xmlns:my="http://java.sun.com/jsf/composite/components/my" >
<cc:interface />
<cc:implementation>
     <my:nestedComponent content="a text" />
</cc:implementation>
</html>
Run Code Online (Sandbox Code Playgroud)

<!DOCTYPE html PUBLIC ...>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:cc="http://java.sun.com/jsf/composite" >
<cc:interface />
<cc:implementation xmlns:my="http://java.sun.com/jsf/composite/components/my">
     <my:nestedComponent content="a text" />
</cc:implementation>
</html>
Run Code Online (Sandbox Code Playgroud)

(注意<cc:implementation xmlns:my="http://java.sun.com/jsf/composite/components/my">标签)

这就像一个魅力!