所以,
我有一个包含 State 和 City 值的 ArrayList,我必须检查 state 是否等于某个变量,让我们调用它的“var1”,如果这个 state 相等,我必须得到城市名称.. .
我正在创建一个菜单过滤器。
<div class="col-md-3">
<label>#{msg['state']}</label>
<h:selectOneMenu id="mdl-state" value="#{saisReportQueryBean.keyState}" class="form-control">
<f:ajax listener="#{saisReportQueryBean.Teste()}"/>
<f:selectItem itemValue="#{null}" itemLabel="#{msg['select_state']}" noSelectionOption="true" />
<f:selectItems value="#{saisReportQueryBean.keyState}" var="estado" itemValue="#{estado}" itemLabel="#{estado}" />
</h:selectOneMenu>
</div>
<div class="col-md-3">
<label>#{msg['city']}</label>
<h:selectOneMenu id="mdl-city" value="#{saisReportQueryBean.keyCity}" class="form-control">
<f:selectItem itemValue="#{null}" itemLabel="#{msg['select_city']}" noSelectionOption="true" />
<f:selectItems value="#{saisReportQueryBean.keyCity}" var="cidade" itemValue="#{cidade}" itemLabel="#{cidade}" />
</h:selectOneMenu>
</div>
When I select the state, I've to update my city itens with just only city in references with the state selected.
Here is my java code.:
protected void updateData() {
this.reportQuery = new SaisReportQuery();
this.queryExecuted = false;
cidades = cidadesIbgeBeanRemote.findAll();
cidades.sort((f1, f2) -> f1.getMunicipio().compareTo(f2.getMunicipio()));
Map<String, List<CidadeIbge>> estados = cidades.stream().collect(Collectors.groupingBy(CidadeIbge::getUf));
setKeyState(estados.keySet());
getKeyState().toString();
System.out.println(keyState);
}
Tks。
开心每一天1111
相关分类