1

Map<Integer, ArrayList<ObjectBO>>トマホークのデータテーブルにを表示したい。私はいくつかの可能な解決策を試しましたが、何もうまくいかないようです。

<h:panelGrid style="font-family:verdana;font-size:12pt;color:white" columns="1">
    <h:outputText value="Choice 1"></h:outputText>
    <t:dataTable newspaperColumns="1" value="#{startupBean.choiceKeys}" newspaperOrientation="horizontal" var="key">
        <t:column>    
            <h:outputText style="font-family:verdana;font-size:10pt;color:white" value="#{choiceMap[key].ObjectBO.displayName}"/>
        </t:column>
        <t:column>     
            <h:graphicImage width="50" height="50" id="choice" alt="jsf-sun" url="#{choiceMap[Key].ObjectBO.color_url}" value="#{choiceMap[Key].ObjectBO.color_url}"> 
            </h:graphicImage>  
        </t:column> 
    </t:dataTable>
</h:panelGrid>

そのバッキングビーン部分は

public List<Integer> getChoiceKeys() {
    System.out.println("in keys");
    List<Integer> keys = new ArrayList<Integer>();
    keys.addAll(choiceMap.keySet());
    System.out.println("keys " + keys.size());
    return keys;
}

Datatableを介してマップをトラバースする方法を教えてください。

4

1 に答える 1

0

数字は EL では として扱われLongます。コードでは、keyin#{choiceMap[key]}は として扱われるため、は のインスタンスではないLongため、マップ キーは一致しません。このアプローチは、マップ キーの代わりに使用する場合に機能します。IntegerLongLongInteger

于 2012-08-29T12:29:40.393 に答える