2012-10-01 37 views
0

我有一張地圖,我想通過jsf進行迭代。該地圖是 -如何通過jsf ..迭代映射<Map, Map>?

LinkedHashMap<Map<String,String>,Map<String,String>>   propertyMap=new  LinkedHashMap<Map<String,String>,Map<String,String>>(); 

早些時候,我已經在下列方式

List documentProperties = new ArrayList(propertyMap.entrySet()); 

而且在JSF迭代以下地圖上String類型,字符串的JSF: -

<af:iterator value="#{EditProperties.documentProperties}" var="list" id="i1"> 
       <trh:rowLayout id="rl1"> 
        <trh:cellFormat id= "cf3"><af:outputText value="#{list.key}" 
                  id="ot1"/> </trh:cellFormat> 
        <trh:cellFormat id= "cf4"> 
         <af:inputText id="it1" 
             value="#{list.value}" showRequired="false"> 
         </af:inputText>  
        </trh:cellFormat> 
       </trh:rowLayout> 

但如何我可以在jsf中迭代一張內有兩張地圖的地圖嗎? 謝謝

+0

地圖的關鍵點應該是不可變的?你爲什麼使用兩張地圖? –

+0

由地圖鍵控的地圖聽起來像是一個非常糟糕的主意...... –

+0

但我的要求是,我想要在jsf頁面上顯示來自一個spurce本身的4個值 –

回答

1

Map作爲key是壞主意。你應該使用Immutable對象作爲hashmap的關鍵。 如果你想在地圖內聲明地圖,那麼你可以做下面的事情。

LinkedHashMap<String,Map<String,Map<String,String>>> propertyMap=new LinkedHashMap<String,Map<String,Map<String,String>>>(); 
+3

我的眼睛受到所有泛型的傷害:-) –