2012-03-12 73 views
0

嗨,朋友,我已經開發了一個PhotoAlbum應用程序,在顯示照片jsp頁面顯示所有用戶信息以及他們上傳的圖像名稱。它在jsp上顯示的輸出與下面的格式類似。迭代器在struts中顯示標籤列嗎?

========================================================================== 
| NAME | FatherName |AGE|ADDRESS | PhotoList       | 
========================================================================== 
|nathjo r | FATHERNAME |12 | XYZ |[asasdd, asada, asada, aasasada]  | 
|SRT  | ERNAME  |12 | XYZ |[1212, 1212, 1212]     | 
|SRY  | ERNAME  |12 | XYZ |[bb, ccas, asdda, da, qwqda, qwqda, qwqda] | 
========================================================================== 

你可以看到它是完美的,最後一列[PhotoList]是一個字符串列表。所以我的問題是我想在最後一列做迭代[把邏輯迭代器標籤]做附加操作,這取決於最後一列中存在的元素的數量以及顯示圖像名稱。 所以我認爲是這樣的我知道這樣做是錯誤的任何建議這樣做。

<display:table id="data" name="sessionScope.UserForm.userList" requestURI="/userAction.do" pagesize="3" > 
     <display:column property="name" title="NAME" sortable="true" /> 
     <display:column property="fatherName" title="User Name" sortable="true" /> 
     <display:column property="age" title="AGE" sortable="true" /> 
     <display:column property="address" title="ADDRESS" sortable="true" /> 
     <logic:iterate property="photolist" id="photoId" indexId="index"> 
      ***here i want to display the image name*** 
     </logic:iterate> 
</display:table> 

由於提前

+0

內iterate標籤您使用的S2或Struts1的? – 2012-03-12 12:06:39

+0

Struts1 @UmeshAwasthi – user1184777 2012-03-12 16:56:15

回答

0

讓有<display:column>標籤像這樣

<display:table id="data" name="sessionScope.UserForm.userList" requestURI="/userAction.do" pagesize="3" > 
     <display:column property="name" title="NAME" sortable="true" /> 
     <display:column property="fatherName" title="User Name" sortable="true" /> 
     <display:column property="age" title="AGE" sortable="true" /> 
     <display:column property="address" title="ADDRESS" sortable="true" /> 
     <display:column title="Photo List"> 
      <logic:iterate property="photolist" id="photoId" indexId="index"> 
       <s:property />, 
      </logic:iterate> 
     </display:column> 
</display:table>