我想從複選框恢復項目列表檢查,當我迭代列表檢索項目檢查指令while循環到無限的問題 這是我的代碼:while循環到無窮大,當我嘗試從selectManyCheckbox檢索檢查的項目
JSF:
<h:selectManyCheckbox value="#{TestAjax.selectedItemscheckbox}">
<f:selectItem itemValue="priority.pname" itemLabel="By priority" />
<f:selectItem itemValue="project.pname" itemLabel="By project" />
</h:selectManyCheckbox>
代碼:
public Class TestAjax {
private ArrayList<String> selectedItemscheckbox; //list of checkbox used for grouping
public ArrayList<String> getSelectedItemscheckbox() {
return selectedItemscheckbox;
}
public void setSelectedItemscheckbox(ArrayList<String> selectedItemscheckbox) {
this.selectedItemscheckbox = selectedItemscheckbox;
}
public void CreateQueryNumber()
{
Iterator it= selectedItemscheckbox.iterator();
System.out.println("checkeddddddddddd"+selectedItemscheckbox);
while(it.hasNext()) ===>loop to the infinity
{
System.out.println("one"+ it.toString());
select ="select count(jiraissue.id) as nb";
from ="jiraissue j ,priority pr ,project proj";
where="j.project=proj.id";
jointure="j.priority =pr.id";
groupBy="group by "+it.toString();
}
}
,謝謝你,我已經puted it.toString()而不是it.next(),這是因爲我還沒有喝咖啡還沒有:) – rym
,每天早晨發生! = P – Fido