欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
struts標簽中的多層logic:iterator詳解(原創(chuàng ))

logic:Iterator標簽(以下簡(jiǎn)稱(chēng)“該標簽”)是Struts里非常常用的一個(gè)標簽,其作用在于循環(huán)顯示給定容器對象中的值。

如此常用的標簽,其源代碼當然需要拿出來(lái)研究一下,以下列舉幾條研究成果:
1、該標簽內部使用Collection來(lái)表示給定的容器,所有的給定容器對象(如ArrayList,Map等)都會(huì )被其轉化成為Collection,Collection實(shí)際就是Map和List的父類(lèi)。
2、該標簽自己維護循環(huán)索引,不用程序員管理索引
3、該標簽常見(jiàn)的幾個(gè)屬性如下:name、property、scope、id

對應Struts給出的Api說(shuō)明如下:
name:包括要遍歷Collection的Jsp頁(yè)面的bean的名字(如果property沒(méi)有被定義),或者是那些通過(guò)getter方法獲得屬性的Jsp中的Bean的名字,這些getter方法返回的是Collection(如果property定義了)。
property:在name命名的Jsp bean中定義的屬性的名字,通過(guò)getter方法返回一個(gè)Collection
scope:指示到哪里去尋找name為名字的bean,如果沒(méi)有定義缺省為"any scope"
id:如果Collection非空的話(huà),在每次遍歷時(shí)候Collection中每個(gè)元素的名字。


其中除了id每個(gè)元素均為Rt expr,這兒的rt expr的意思就是Run Time Expression。明確的說(shuō)就是,如果你對一個(gè)Attribute的<rtexprvalue>指定為true,你就可以在這樣的屬性中使用<%=%>之類(lèi)的東東。這個(gè)配置文件在tld中。
只有id是必須要說(shuō)明的。


關(guān)于A(yíng)pi說(shuō)明的說(shuō)明:
id只是一個(gè)臨時(shí)標識,在下面的<bean:write里面出現的name屬性要和id一致才能打印出<bean:write的property,而此property就是在iterator中的屬性。

舉例說(shuō)明
以下代碼生成一個(gè)階梯狀表格
 系統 資源 操作
 soft3     
     res3   
          opt3
 soft12     
     res12   
          opt1211
 soft11     
     res11   
          opt1111

在此之前傳來(lái)一個(gè)request.getAttribute("userPurview"),所以有在第一個(gè)logic中的userPurview,就是在這個(gè)request里面尋找userPurview
返回的是一個(gè)list

<table width="300" border="0">
<tr><td>系統</td>
<td>資源</td>
<td>操作</td>
</tr>
 <logic:iterate id="targetSys" name="userPurview" scope="request">  //這個(gè)id可以隨便起名,但是要注意下文使用的一致性
 <tr bgcolor="#cccccc"><td height="21" class="unnamed2">
 <bean:write name="targetSys" property="cn"/>        //此處name和上面id保持一致,property就是第一個(gè)list里面的元素
 </td>
 <td height="21" class="unnamed2"> </td>
 <td height="21" class="unnamed3"> </td>
 </tr>
  <logic:iterate id="targetRes" name="targetSys" property="purviewResList">
  <tr><td height="21" class="unnamed2"> </td><td  height="21" class="unnamed5">
  <bean:write name="targetRes" property="cn"/>
  </td>
  <td  height="21" class="unnamed6"> </td>
  </tr>

   <logic:iterate id="targetOpr" name="targetRes" property="purviewOprList">
   <tr><td height="21" class="unnamed4"> </td><td  height="21" class="unnamed4"> </td>
   <td  height="21" class="redzi">
   <bean:write property="cn" name="targetOpr"/></td>
   </tr>
   </logic:iterate>

  </logic:iterate>

 </logic:iterate>
</table>


結論:
多級迭代和單層差不多,唯一注意的就是id和<bean:write中的name的對應,上級logic的id與下級logic的name對應,并且取出來(lái)的要是個(gè)Collection,name和id不一定實(shí)際需要這個(gè)bean,都是虛擬的。

本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
struts標簽之淺入深出 OBS [和訊博客]
Struts標簽(大全)二
struts logic標簽使用舉例--logic篇 -JAVA編程技術(shù)服務(wù)網(wǎng)
Struts1.x系列教程(7):Logic標簽庫
struts1 logic:iterate bean:write標簽使用
Struts標簽
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久