js文件:
在經過dropdown1 [I]中,只有一個單獨元件被傳遞。但果德[I]項[i]的完全合格。從js文件傳遞數組值JSP文件
for(var i=0;i<count;i++)
{
dropdown1[i]=document.getElementById("sel"+i).value;
kot[i]=document.getElementById("kot"+i).value;
item[i]=document.getElementById("itemcode"+i).value;
if(dropdown1[i] == 0){
document.detailsview.action="BillCB.jsp?method=" + "11" + "&itemcode=" +item[i]+ "&kot=" +kot[i]+ "&itemStatus1=" +dropdown1[i]+ "&billno=" +billno;
}
else if(dropdown1[i] == 1){
document.detailsview.action="BillCB.jsp?method="+"9"+"&itemcode="+item[i]+"&kot="+kot[i]+"&itemStatus1="+dropdown1[i]+ "&billno="+billno;
}
else{
document.detailsview.action= "BillCB.jsp?method="+"10"+"&itemcode="+item[i]+"&kot="+kot[i]+"&itemStatus1="+dropdown1[i]+ "&billno="+billno;
}
}
JSP文件:
case 11:
gotMethod = true;
billdetails_be.billno = Integer.valueOf(request.getParameter("billno"));
String[] kotCB2=request.getParameterValues("kot");
String[] itemCB2=request.getParameterValues("itemcode");
String[] statCB2=request.getParameterValues("itemStatus1");
int[] kotarr2=new int[kotCB2.length];
int[] itemarr2=new int[itemCB2.length];
int[] statarr2=new int[statCB2.length];
System.out.println("IN AVAILABLE:length of array is:"+statCB2.length);
System.out.println("IN AVAILABLE:length of array is:"+kotCB2.length);
for(int i=1;i<itemarr2.length;i++)
{
kotarr2[i]=Integer.parseInt(kotCB2[i]);
}
for(int i=1;i<itemarr2.length;i++)
{
itemarr2[i]=Integer.parseInt(itemCB2[i]);
}
for(int i=1;i<itemarr2.length;i++)
{
statarr2[i]=Integer.parseInt(statCB2[i]);
}
for(int i=1;i<itemarr2.length;i++)
{
int kotint2=kotarr2[i];
int itemint2=itemarr2[i];
int statint2=statarr2[i];
System.out.println(i+"the value of kot in available"+ kotint2);
int availablebill = websrv.availablebill(billdetails_be.billno, kotint2, itemint2,statint2);
}
你看上去產生UR L爲每個項目,無處通過多個項目。你可以顯示HTML嗎? – Jason 2014-09-03 07:15:08
你可以在js文件中檢查數組的聲明(dropdown1 [i],kot [i],item [i])。或者顯示那些數組聲明。 – 2014-09-03 07:15:32
你在使用二維數組嗎?對於dropdown1 [i],kot [i],item [i] – 2014-09-03 07:18:37