私は、リストのオブジェクトがマップのキーと同じかどうかをどのようにテストできるかを調べようとしています。Listに含まれるオブジェクトが、JSTLタグまたはStrutsタグを使用するJSPのMapのキーと同じであるかどうかを確認するにはどうすればよいですか?
Javaクラス:
private Map<String, List<Country>> continent;
private List<Country> countries;
国:
private String continentCode;
private String countryCode;
//other attributes
大陸のMap
キーがcontinentCode
です。
のjsp:
<s:iterator value=countries var=country>
<c:when test="${not empty continent[country.continentCode]}">
<s:property value="country.continentCode"/>
<s:property value="country.countryCode"/>
</c:when>
</s:iterator>
私は<c:when>
タグとわかりません。大陸地図にcontinentCode
が存在する場合、リストのCountry
オブジェクトが表示されます。
私はタグを忘れてしまったと考えています。しかしそれ以外は、私のコードが動作します。 –
ERCK