2011-02-03 14 views
1

JSF 2.0のコンポーネントにいくつかのwebbeanによってgettedされたリストを渡す方法があるかどうか知りたいですか? webbean getListは、クライアントのリストをコンポーネントに返します。例えば:コンポジットにBeanメソッドを渡す

コンポーネント:

<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> 

userpageリストオブジェクトを返すwebBeanの位置を通過しなければなりません。

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

私に例を挙げてください。

お勧め

答えて

2

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

値にアクセスすると、 "いつものように" 起こるはず:

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

実装は#{cc.attrs.attributeName}によって属性にアクセスする必要があります:

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

は、より多くの使用例については、tag documentationを確認してください。

関連する問題