Hi all,
I was using Alfresco 5.0.a community for developing dashlets and java backed webscipts. Alfresco.util.Ajax.request with POST was working fine in 5.0.a. But when i upgraded to Alfresco 5.0.C, it stopped working. Parameters sent in dataObj ( as given below ) are not reaching to the java backed webscript, i am getting the null values from WebScriptRequest (request) object. Where in Alfresco 5.0.a its working fine.
(
dataObj: {
breadcrumb : selectedBreadcrumb,
id: id,
format : "html"
}
)
JavaWebscript:
public class DashletAction extends DeclarativeWebScript {
@Override
protected Map<String, Object> executeImpl(final WebScriptRequest request,
final Status status, final Cache cache) {
cache.setNeverCache(true);
// Retrieve and validate parameters
final String breadcrumb = request.getParameter("breadcrumb"); //GETTING NULL here in Alfresco 5.0.c
final String id = request.getParameter("id"); //GETTING NULL here in Alfresco 5.0.c
final String format = request.getParameter("html"); //GETTING NULL here in Alfresco 5.0.c
//……DO Something with these parameters
}
}
Ajax call from .ftl File:
function onDashletAction(obj){
var scriptURL = Alfresco.constants.PROXY_URI+"component/data-integration/dashlet-action;
var selectedID = document.getElementById(obj.id).value.split("|");
INPUTNAME = obj.name; // Set the input name to global INPUTNAME variable.
var breadcrumbId = selectedID[0];
var id=selectedID[1];
var selectedBreadcrumb = document.getElementById(breadcrumbId).value;
Alfresco.util.Ajax.request({
url: scriptURL,
method: Alfresco.util.Ajax.POST,
timeout:200000,
dataObj: {
breadcrumb : selectedBreadcrumb,
id: id,
format : "html"
},
successMessage: "Successfully retrieved the Hierarchy.",
successCallback: {
fn: this.handleSuccess,
scope: this
},
failureMessage: "Failed to retrieved the Hierarchy!",
failureCallback: {
fn: this.handleFailure,
scope: this
},
execScripts: true
});
}