9
A
回答
14
你應該能夠循環通過按鍵這樣的:
<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);
}
我沒有編這一點,但它應該幫助你開始。
相關問題
- 1. 通過哈希映射映射,需要返回哈希映射
- 2. 通過嵌套for循環初始化哈希映射
- 3. 通過無迭代器的哈希映射循環
- 4. 迭代通過哈希映射'塊'
- 5. 通過支持哈希映射查詢
- 6. 如何迭代通過哈希映射映射列表元素
- 7. 循環通過陣列從哈希表
- 8. 通過Ember JS RSVP哈希循環?
- 9. Perl通過陣列哈希循環
- 10. 哈希映射內的哈希映射的平均值
- 11. 哈希映射和併發哈希映射有什麼區別?
- 12. 檢測循環扶養在哈希映射在Java中
- 13. 無法運行循環哈希映射的方法
- 14. 使用哈希映射
- 15. 哈希映射迭代
- 16. 排序哈希映射
- 17. 實現哈希映射
- 18. PowerShell哈希映射類型
- 19. 使用哈希映射
- 20. 哈希映射對象鍵
- 21. 哈希映射的成員?
- 22. 迭代哈希映射
- 23. 聚簇哈希映射
- 24. 方法從哈希映射
- 25. 映射到一個哈希
- 26. Python中的哈希映射
- 27. 我想創建一個哈希映射與內部映射和外部映射關係的哈希映射?
- 28. 從哈希映射通過變量獲得密鑰
- 29. 通過嵌套哈希映射進行迭代
- 30. 如何通過哈希映射數據BaseAdapter Android中
非常感謝!這正是我正在尋找的。必須添加一個方法。 public String getLabelValue(){ \t return this.getMyMap()。get(this.currentKey); } and change 爲了顯示我的HashMap的值並將按鍵傳遞到下一頁。 非常感謝... – Sfairas 2010-03-15 16:29:59