我是jsp的新手,對顯示標籤的輸出功能很感興趣。我說,我有這樣的簡單結構:使用jsp的displaytag遍歷對象列表
public class MyActionBean implements ActionBean{
List<Country> countries;
// getters and setters and some other un-related logic
}
public class Country {
List<String> countryName;
List<Accounts> accounts;
// getters and setters and some other un-related logic
}
public class Accounts {
private FinancialEntity entity;
// getters and setters and some other un-related logic
}
public class FinancialEntity {
String entityName;
// getters and setters and some other un-related logic
}
現在,我想要做一個表,該表將有兩列 - 國家名稱和的entityName(FinancialEntity)
<display:table id="row" name="${myActionBean.countries}" class="dataTable" pagesize="30" sort="list" defaultsort="8" export="true" requestURI="">
<display:column title="Country" sortable="true" group="1" property="countryName" />
<display:column title="Financial Entity"> somehow get all of the entity names associated with the country? </display:column>
</display:table>
所以,基本上我想迭代賬戶並獲得所有金融實體。我不知道如何在JSP中使用displaytag來做到這一點。我嘗試使用c:forEach並顯示:setProperty標記,但它看起來像這個標記不是爲了這些目的。我致命陷:(
預先感謝您:)
你好,非常感謝你的回覆。但是,這不起作用。原因是,會有多個列(我只提到了兩個,但還有更多),我需要通過jsp :( – user1039063