9
해시 맵을 반복하고 해시 맵의 키에 id가있는 숫자 확인란을 표시하고 해시 맵의 값에 레이블을 지정하려고합니다. 누구든지 그 태피스 트리 구문이 어떤지 알고 있습니다.Tapestry through hashmap
건배 디미트리
당신은이 같은 키 집합을 통해 루프를 할 수 있어야한다해시 맵을 반복하고 해시 맵의 키에 id가있는 숫자 확인란을 표시하고 해시 맵의 값에 레이블을 지정하려고합니다. 누구든지 그 태피스 트리 구문이 어떤지 알고 있습니다.Tapestry through hashmap
건배 디미트리
당신은이 같은 키 집합을 통해 루프를 할 수 있어야한다:
<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);
}
내가이 컴파일되지 않은,하지만 시작하는 데 도움이 될 것입니다.
감사합니다. 그게 정확히 내가 찾고 있었던거야. 메소드를 추가해야했습니다. public String getLabelValue() { \t 이것을 반환합니다. getMyMap(). get (this.currentKey); } 내 HashMap의 값을 표시하고 키를 다음 페이지로 전달하려면 으로 변경하십시오. 고맙습니다 ... – Sfairas