Так,
У меня есть список ArrayList со значениями State и City, и я должен проверить, равно ли состояние какой-либо переменной, позвольте назвать его "var1", и если это состояние равно, я должен получить названия городов .. .
Я создаю фильтр меню.
<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);
}
Ткс.
У вас действительно есть вопрос?
Все, что вы здесь сделали, это рассказали нам о своем задании. Покажите, что вы пробовали, и объясните, в чем именно заключается ваше замешательство.
См. Эту ссылку, она предоставляет информацию о том, как задать вопрос в SO. stackoverflow.com/help/how-to-ask
Вопрос не ясен - смотрите Как спросить.
Я добавил еще контекст




Извините всех за мой незавершенный вопрос.
Я хочу сказать, что когда я выбираю какое-то значение в своем меню, это должно изменить другое меню со значениями в referente:
Передняя реализация:
<h:panelGroup layout = "block" class = "col-md-3" id = "panel-state">
<label>#{msg['state']}</label>
<h:selectOneMenu id = "mdl-state" value = "#{saisReportQueryBean.reportQuery.state}" binding = "#{uf}" class = "form-control input_no_round_corner">
<f:selectItem itemValue = "#{null}" itemLabel = "#{msg['select_state']}" noSelectionOption = "true" />
<f:selectItems value = "#{saisReportQueryBean.keyState}" var = "estado" itemValue = "#{estado}" itemLabel = "#{estado}" />
<f:ajax listener = "#{saisReportQueryBean.UpdateCityByState(uf.value)}" render = ":panel-city" event = "change" execute = "@this" onevent = "initializeChosenFieldsCity">
</f:ajax>
</h:selectOneMenu>
</h:panelGroup>
<h:panelGroup layout = "block" class = "col-md-3" id = "panel-city">
<label>#{msg['city']}</label>
<h:selectOneMenu id = "mdl-city" value = "#{saisReportQueryBean.listCidades}" class = "form-control input_no_round_corner">
<f:selectItem itemValue = "#{null}" itemLabel = "#{msg['select_city']}" noSelectionOption = "true" />
<f:selectItems value = "#{saisReportQueryBean.listCidades}" var = "cidade" itemValue = "#{cidade.municipio}" itemLabel = "#{cidade.municipio}" />
</h:selectOneMenu>
</h:panelGroup>
Задняя реализация:
cidades = cidadesIbgeBeanRemote.findAll();
setKeyState(new ArrayList(estados.keySet()));
getKeyState().toString();
getKeyState().sort((f1, f2) -> f1.compareTo(f2));
Пожалуйста, сделайте свой вопрос полным и понятным.