08-06-2018 07:15 AM
Hello All,
I am calling a java webscript from a ftl.
var uri = Alfresco.constants.PROXY_URI+"/vs/insurancetype?" + encodeURIComponent("company="+companyValue+"&insurancetype="+insuranceValue);
this.register = function () {
Alfresco.util.Ajax.jsonGet({
url: uri,
successCallback: {
fn: this.updateSubInsuranceType,
scope: this
},
failureCallback: {
fn: function(){},
scope: this
}
});
Passing Parameter:
var companyValue = "A&B Company";
var insuranceValue = "R&K insurance"
Request URL:
When I get the request in Java Webscript.
final String insuranceCompany = req.getParameter("company"); ///companyValue= A
final String insurancetype = req.getParameter("insurancetype"); /// insuranceValue=R
Basically, I am not getting right parameter from the request object.
Please suggest...
08-07-2018 04:31 AM
You should not be encoding the entire URL arguments via encodeURIComponent. It is more appropriate to encode only the values individually before combining them into the URL. So the URL should look more like
(Note: You also do not need the leading slash in your URL addition since the PROXY_URI already ends with a slash)
08-07-2018 05:00 AM
Hello Thanks for reply.
I have already tried this way too...Only encode value "A&B Company" but still in WebScriptRequest I am getting full path and parameters value without encoding. I have tried to decode as well in java webscript as well.
Explore our Alfresco products with the links below. Use labels to filter content by product module.