我是新手工作灯。现在我开始使用适配器。检查此链接我的stackoverflow朋友之一有同样的怀疑click this在应用程序内调用该过程。我正在使用的适配器是SqlAdapter。但是在ibm worklight教程中,他们为HttpAdapter提供了示例,并在函数内部执行了该过程。但不适用于SqlAdapter。如果有任何建议请让我知道。如果你想要我的来源,我会准备提供。我的研究仍在继续
答案 0 :(得分:3)
从应用程序到适配器的调用对于所有类型的适配器都是相同的。
function getData() {
var invocationData = {
adapter : 'ADAPTER_NAME',
procedure : 'PROCEDURE_NAME',
parameters : []
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : getDataSuccess,
onFailure : getDataFailure,
});
}
有关详情,请查看module 6 - Invoking Adapter Procedures from the Client Applications (PDF, 370KB)和the exercise and code sample (ZIP, 53.7KB)
答案 1 :(得分:1)
我在这里检索了这些值。但它没有显示在html页面中。这是我的代码
function wlCommonInit(){
// Common initialization code goes here
WL.Logger.debug("inside the wlcommoninit");
busyIndicator = new WL.BusyIndicator('AppBody');
getData();
}
function loadFeedsSuccess(result){
WL.Logger.debug("Feed retrieve success");
}
function loadFeedsFailure(result){
WL.Logger.error("Feed retrieve failure");
}
function getData() {
var invocationData = {
adapter : 'SqlAdap',
procedure : 'procedure1',
parameters : []
};
WL.Client.invokeProcedure(invocationData,{
onSuccess : loadFeedsSuccess,
onFailure : loadFeedsFailure,
});
}