我想使用数据表在 view_lang.xhtml 中显示语言,下面是我的课程
CountryBean.java
private ArrayList<Country> existingCountryList;
public ArrayList<Country> getExistingCountryList() {
System.out.println("CountryBean.getExistingCountryList::Enter");
existingCountryList = new ArrayList<Country>();
existingCountryList.addAll(getCountryService().getExistingCountry());
System.out.println("existingCountryList in countryBean"+existingCountryList);
System.out.println("CountryBean.getExistingCountryList:::Exit");
return existingCountryList;
}
国家.java
private Set<CountryLanguage> countryLanguage = new HashSet<CountryLanguage>(0);
CountryLanguage.java
private CountryLanguageID countryLangPK = new CountryLanguageID();
CountryLanguageID.java
private Country country;
private Language language;
view_lang.xhtml
<h:dataTable id="existingCountry" var="countryLang" value="#{countryBean.existingCountryList}"
style="width: 100%" cellpadding="0" cellspacing="1" border="0" class="role_detail_section" rowClasses="activity_white, activity_blue">
<h:column>
<f:facet name="header">
<h:outputText value="Language(Code)" styleClass="heading_pm_det_white"/>
</f:facet>
<h:outputText value="#{countryLang.languageName}(#{countryLang.languageCode})" styleClass="heading_pm_det_white" />
</h:column>
</h:dataTable>
我能够使用语言获取国家/地区对象,但无法在数据表中打印。我必须使用 forEach 什么是 syntex,如果是,那么如何。谢谢