我正在尝试使用.js
将.jsp
文件中的函数值传递给document.formname.action
文件,但是它创建了超出范围的数组索引。
我的.js
文件(请注意此行:document.detailsview.action=" "
):
function savetheChanges(count)
{
var kkot1=new Array();
var iitemcode1=new Array();
var dropdown11=new Array();
var billno=document.getElementById("billno").value;
for(var i=0;i<count;i++)
{
var selec = document.getElementById("sel"+i);
dropdown11[i] = selec.options[selec.selectedIndex].value;
kkot1[i]=document.getElementById("kot"+i).value;
iitemcode1[i]=document.getElementById("itemcode"+i).value;
//var dummydrop=dropdown1[i];
alert(i+" "+dropdown11[i]);
//var mydropp=dropdown11[i];
}
document.detailsview.action="BillCB.jsp?method=" + "11" + "&billno="+billno+"&itemStatus1="+dropdown11+ "&kot="+kkot1+ "&itemcode="+iitemcode1;
}
BillCB.jsp
(method11
):
case 11:
gotMethod = true;
billdetails_be.billno = Integer.valueOf(request.getParameter("billno"));
String[] kotCbb=request.getParameterValues("kot");
String[] itemCbb=request.getParameterValues("itemcode");
String[] statCbb=request.getParameterValues("itemStatus1");
System.out.println("IN AVAILABLE:Size of KOT array is :" +kotCbb.length);
System.out.println("IN AVAILABLE:Size of ITEM array is:"+itemCbb.length);
System.out.println("IN AVAILABLE:size of STATUS array is:"+statCbb.length);
控制台中的输出是:
IN AVAILABLE:Size of KOT array is :19
IN AVAILABLE:Size of ITEM array is:19
IN AVAILABLE:size of STATUS array is:1