1

顧客リスト用の複合コンポーネントを作成しました。このコンポーネントをビューで使用できます。

<html 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:p="http://primefaces.org/ui"
  xmlns:customer="http://java.sun.com/jsf/composite/components/customer">

<ui:composition template="/WEB-INF/templates/template.xhtml">

  <ui:define name="caption">
    <h:outputText value="#{msg.customerListHeading}" />
  </ui:define>

  <ui:define name="content">

    <ui:decorate template="/WEB-INF/templates/sidebox.xhtml">
      <ui:param name="title" value="#{msg.customerListHeading}" />

      <p:outputPanel>
        <h:form id="customerList">

          <customer:list list="#{customerControllerBean.list}">
            <f:facet name="headerButton">
              <h:button outcome="customerdetail.jsf"
                value="#{msg.newButtonLabel}" />
            </f:facet>
            <f:facet name="rowButton">
              <h:commandButton value="#{msg.deleteButtonLabel}"
                action="#{customerControllerBean.delete(customer)}" />
              <h:button outcome="customerdetail.jsf?id=#{customer.id}"
                value="#{msg.editButtonLabel}" />
            </f:facet>
          </customer:list>

        </h:form>
      </p:outputPanel>
    </ui:decorate>

  </ui:define>

</ui:composition>

</html>

しかし、非常によく似たビューでコンポーネントを使用すると、次のエラーが発生します。

<customer:list> Tag Library supports namespace: http://java.sun.com/jsf/composite/components/customer, but no tag was defined for name: list

問題のあるビューは次のようになります。

<html 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:p="http://primefaces.org/ui"
  xmlns:customer="http://java.sun.com/jsf/composite/components/customer">

<ui:composition template="/WEB-INF/templates/template.xhtml">

  <ui:define name="caption">
    <h:outputText value="#{msg.customerListHeading}" />
  </ui:define>

  <ui:define name="content">

    <ui:decorate template="/WEB-INF/templates/sidebox.xhtml">
      <ui:param name="title" value="#{msg.customerListHeading}" />

      <p:outputPanel>
        <h:form id="customerList">

          <customer:list list="#{customerControllerBean.list}">
            <f:facet name="rowButton">
              <h:commandButton value="#{msg.applyButtonLabel}"
                action="#{orderControllerBean.setCustomer(customer)}" />
            </f:facet>
          </customer:list>

        </h:form>
      </p:outputPanel>
    </ui:decorate>

  </ui:define>

</ui:composition>

</html>

2つのビューは、2つの異なるコンテキストでリストを使用するため、顧客リストテーブルにボタンを追加するために使用するファセットによってのみ異なることがわかります。しかし、なぜ2番目のビューが機能しないのですか?

Mojarraに問題がある/あったことがわかりましたが、この問題に関してはいわゆる安定したリビジョンを使用しています。

2012-09-16 19:09:41,512 INFO     [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Mojarra 2.1.7-jbossorg-1 (20120227-1401)
4

2 に答える 2

4

Mojarra Jiraでこの問題の回避策を見つけました:http: //java.net/jira/browse/JAVASERVERFACES-2437

タグにを配置するxmlns:customer="http://java.sun.com/jsf/composite/components/customer"ui:composition、ビューが正常にレンダリングされました。

<html 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:p="http://primefaces.org/ui"
  xmlns:customer="http://java.sun.com/jsf/composite/components/customer">

<ui:composition template="/WEB-INF/templates/template.xhtml" xmlns:customer="http://java.sun.com/jsf/composite/components/customer">

  <ui:define name="caption">
    <h:outputText value="#{msg.customerListHeading}" />
  </ui:define>

  <ui:define name="content">

..。

そのJiraによると、問題はMojarra 2.1.10で修正されているので、JBossがAS7.1をすぐに更新することを願っています...:)

于 2012-09-22T18:58:39.907 に答える
-1

不正なフォルダパス(コンポーネント)がEclipseによって表示されます

ビルドパスからsrc/main/resourceを削除します-ビルドパス==>ビルドパスから削除します。
そして、ビルドパスに再度追加します

于 2014-12-02T12:13:25.320 に答える