1

WebBeanによって取得されたリストをJSF2.0のコンポーネントに渡す方法があるかどうか知りたいですか?webbean getListは、クライアントのリストをコンポーネントに返します。例えば:

成分:

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:composite="http://java.sun.com/jsf/composite">
<head>
  <title>This will not be present in rendered output</title>
</head>
<body>

<composite:interface>
  <composite:attribute name="list" required="true"/>
</composite:interface>

<composite:implementation>
  <h:dataTable id="clients" value="#{list}" var="client">
    <h:column>
      <f:facet name="header">
        <h:outputText value="Client"></h:outputText>
      </f:facet>
      <h:outputText value="#{client.username}"></h:outputText>
    </h:column>
    ....
  </h:dataTable>
</composite:implementation>
</body>
</html>

ユーザーページは、Listオブジェクトを返すwebBeanの場所を渡す必要があります。

....
<components:list-client list="webBean.getList"/>
....

例を挙げていただけますか?

よろしくお願いします

4

1 に答える 1

2

変更する必要があるのは2つだけです。

値へのアクセスは「通常どおり」に行われる必要があります。

<components:list-client list="#{webBean.list}" />

実装は、次の方法で属性にアクセスする必要があります#{cc.attrs.attributeName}

<h:dataTable id="clients" value="#{cc.attrs.list}" var="client">

その他の使用例については、タグのドキュメントを確認してください。

于 2011-02-04T02:18:18.693 に答える