我要编辑一个2000行的javascript文件,以维护并向以JSP,Json-RPC,jQuery和Java编写的Web应用程序添加一些新功能,这是一项令人羡慕的任务。除了基本的Javascript知识之外,我对jQuery和Json-RPC没有更深入的了解,并且不再有原始开发人员。有一个JS函数接受一些参数,并调用Json-RPC,在这里我得到了错误
arg 1无法解组
有人可以告诉我这个错误是什么意思吗?
这是我的代码
function distributeQuantityNew(pReportId, pDecimalPlaces, pRun) {
try {
alert('distributeQuantityNew: ' + pReportId + ', ' + pDecimalPlaces + ', ' + pRun);
var fieldValue = $("#distribution_quantity_" + pReportId).val();
if (fieldValue.length == 0) {
showErrorDialog(resourceBundleMap["error.no.distribution.quantity"]);
return;
} else {
$("#distribution_quantity_" + pReportId).val("");
}
var affectedRowIds = [];
var rows = $("#tableBody_" + pReportId + " tr:visible").has("input[type=text]").filter(function(index) {
var voucherType = this.cells[getVoucherColumnIndex()].innerHTML;
if ((voucherType == 'TRANSFER_CS') || (voucherType == 'PAYOUT_CS') || (voucherType == 'SOURCE_BON') || (voucherType == 'PAYOUT_BON')) {
return false;
}
affectedRowIds.push(parseInt(this.id.split("_")[3]));
return true;
}
);
var affectedReportRows = $.extend(true, {}, foreignReportMap[pReportId]);
$.each(affectedReportRows.map, function(i, row) {
if ($.inArray(row.partnerReportBillNr, affectedRowIds) == -1) {
delete affectedReportRows.map["row_" + row.partnerReportBillNr];
}
});
var report = getLoadedReportByRunId(pReportId);
var productType = report.partnerProductType;
SessionManager.extend();
var resultRows = jsonrpc.foreignReportObject.distributeQuantity(affectedReportRows, fieldValue, pDecimalPlaces, pRun);
alert('back after RPC');
$.each(resultRows.map, function(i, row) {
foreignReportMap[pReportId].map["row_" + row.partnerReportBillNr] = row;
updateForeignReportRow(row, true, productType);
});
updateSummaryRow(pReportId);
toggleApproveAllLink(pReportId);
sortForeignReportTable(pReportId, true);
} catch (e) {
handleError("Failed to distribute quantity: ", e);
}
}
我给它添加了警报,以便我知道RPC调用是否成功,但是arg 1 could not unmarshal
在那之前我从catch块得到了错误。谢谢你的提示
好,解决了。远程功能的第一个参数应包含的列表Map<String, SomeBO>
。SomeBO
是带有几个BigDecimals的bean。我还有另一个JS函数,它设置了传递到Map中的值。此功能设置了BigNumber
我只有二传手的位置String
。我希望我从JSON解组器获得的错误更具描述性...下面是我添加.toString()
来解决该问题的代码
foreignReportMap[pReportId].map["row_" + pRowId].clientQuantity = clientQuantity.toString();
foreignReportMap[pReportId].map["row_" + pRowId].totalClientQuantity = totalClientQuantity.toString();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句