आप इस तरह कुंजी सेट लूप करने के लिए सक्षम होना चाहिए:
<form t:type="Form">
<t:Loop t:source="myMap.keySet()" t:value="currentKey">
<input type="Checkbox" t:type="Checkbox" t:id="checkbox"
t:value="currentValue"/>
<label t:type="Label" for="checkbox">${mapValue}</label>
</t:Loop>
</form>
कक्षा फ़ाइल:
@Property
private Object currentKey;
@Persist
private Set<String> selection = new HashSet<String>();
public Map<String,String> getMyMap() {
...
}
public boolean getCurrentValue() {
return this.selection.contains(this.currentKey);
}
public void setCurrentValue(final boolean currentValue) {
final String mapValue = this.getMapValue();
if (currentValue) {
this.selection.add(mapValue);
} else {
this.selection.remove(mapValue);
}
}
public String getMapValue() {
return this.getMyMap().get(this.currentKey);
}
मैं इस संकलित नहीं किया है, लेकिन यह शुरू करने में आपकी मदद करनी चाहिए।
बहुत बहुत धन्यवाद !!! यही वही है जो मैं खोज रहा था। एक विधि जोड़ना पड़ा। सार्वजनिक स्ट्रिंग getLabelValue() { \t इसे वापस करें .getMyMap()। (This.currentKey) प्राप्त करें; } और <लेबल टी: टाइप = "लेबल" = "चेकबॉक्स"> $ {लेबल वैल्यू} मेरे हैश मैप के मान प्रदर्शित करने के लिए और अगले पृष्ठ पर कुंजी पास करने के लिए बदलें। बहुत बहुत धन्यवाद ... – Sfairas