我有一个加载BD列表的selectOneMenu,调试可以验证所有步骤都是正确的,除了它在selectOneMenu中显示值的时间。在页面上出现对象名称“JanelaPortabilidade @ 7437”,而不像字符串。
我的代码:
public List<SelectItem> listarHoraJanela(DateSelectEvent event) {
dataF = event.getDate();
Calendar dataAux = new GregorianCalendar();
dataAux.setTime(dataF);
//Corrigir
if (listaHoraJanela == null) {
listaHoraJanela = new ArrayList<JanelaEAPortabilidade>();
listaHoraJanela = consultaJPortabilidade.listarHoraJanela(dataAux);
listSelectHoraJ.add(new SelectItem("", ""));
for (JanelaEAPortabilidade horaJ : listaHoraJanela) {
String dataFormat = String.format("%02d",horaJ.horIniJanela.get(Calendar.HOUR_OF_DAY));
System.out.println(dataFormat);//So here is ok, print in console correct string
listSelectHoraJ.add(new SelectItem(horaJ.getIdtJanela(),dataFormat));
}
}
xhtml:
<h:outputText value="Hora da Janela:" for="horaJanela" />
<h:selectOneMenu value="#{bean.codHoraJanela}" id="horaJanela"
rendered="#{bean.type == 'Fixo'}" >
<f:selectItems value="#{bean.listaHoraJanela}" />
会是什么?我肯定错过了什么。
谢谢!