用struts标签输出list、map

代码如下

  ArrayList  testList=new ArrayList(); 
  HashMap testMap1=new HashMap();
	  testMap1.put("grade","七年级");
	  testMap1.put("class","一班"); 
	  testMap1.put("master","张三"); 
  testList.add(testMap1); 

  HashMap testMap2=new HashMap();
	  testMap2.put("grade","八年级"); 
	  testMap2.put("class","二班"); 
	  testMap2.put("master","张三"); 
 testList.add(testMap2);  

  HashMap testMap3=new HashMap();
	  testMap3.put("grade","九年级");
	  testMap3.put("class","五班");
	  testMap3.put("master","李四"); 
  testList.add(testMap3);

 

<table border="1" cellpadding="0" cellspacing="0" bordercolor="#0033CC" name="tableList">     <tr><td>master</td><td>class</td><td>grade</td></tr> 
	<logic:iterate id="element" indexId="ind" name="testList" >
	<tr>
		<td> 
			<logic:iterate id="elementValue" indexId="idx" name="element"> 
				<logic:equal name="elementValue" property="key" value="master">                    
					<bean:write name="elementValue" property="value"/> 
				</logic:equal>      
			</logic:iterate>
		</td>                                   
		<td> 
			<logic:iterate id="elementValue" indexId="idx" name="element">      
				<logic:equal name="elementValue" property="key" value="class">                    
					<bean:write name="elementValue" property="value"/>                   
				</logic:equal>     
			</logic:iterate>    
		</td>                  
		<td>
			<logic:iterate id="elementValue" indexId="idx" name="element">        
				<logic:equal name="elementValue" property="key" value="grade">                    
					<bean:write name="elementValue" property="value"/>                    
				</logic:equal>     
			</logic:iterate>       
		</td>            
	</tr>            
	</logic:iterate>    
</table>

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值