JSP
<ice:selectManyCheckbox id="selectManyCheckBoxPrueba" value="#{PruebaBean.daysSelected}">
<f:selectItems value="#{PruebaBean.days}"/>
</ice:selectManyCheckbox>
<ice:commandButton action="#{PruebaBean.buttonMostrarSeleccionadosEnInputText_action}" id="buttonMostrarSeleccionadosEnInputText" value="submit"/>
<ice:inputText binding="#{PruebaBean.inputText1}" id="inputText1"/>
Bean
ArrayList<SelectItem> days = new ArrayList<SelectItem>();
String[]daysSelected;
//getters y setters
public ArrayList<SelectItem> getDays()
{
ArrayList<SelectItem> returnList = new ArrayList<SelectItem>();
returnList.add(new SelectItem("Lunes"));
returnList.add(new SelectItem("Martes"));
returnList.add(new SelectItem("Miercoles"));
returnList.add(new SelectItem("Jueves"));
returnList.add(new SelectItem("Viernes"));
returnList.add(new SelectItem("Sabado"));
returnList.add(new SelectItem("Domingo"));
return returnList;
}
public void setDays(ArrayList<SelectItem> days)
{
this.dateSeries = dateSeries;
}
public String[] getDaysSelected()
{
String[] returnList = new String[2];
returnList[0] = "true";
returnList[1] = "false";
return returnList;
}
public void setDaysSelected(String[] daysSelected)
{
this.dateSeriesSelected = dateSeriesSelected;
}
//action del boton
public String buttonMostrarSeleccionadosEnInputText_action()
{
String text ="";
if (dateSeriesSelected.length > 0)
{
for (int i=0; i <dateSeriesSelected.length; i++)
{
text = text + dateSeriesSelected[i] + " ";
}
}
inputText1.changeText(text);
return null;
}
2 comentarios:
Me has ayudado bastante gracias
Hola amiga, que tal! :D, muchas gracias por tu publicación, es una descripcion bastante buena de como utilizar multiples cajas de seleccion, saludos!
Publicar un comentario