I have a custom control with an ExtLib REST control on it. I’m creating JSON from the rest control. It’s working fine if I hardcode everything inside the doGet tag.
But when I try and access the custom properties via compositeData in the do get I get an error:
com.ibm.domino.services.ServiceException: Error while rendering service
Caused by: com.ibm.xsp.exception.EvaluationExceptionEx: Error while executing JavaScript action expression
at com.ibm.xsp.binding.javascript.JavaScriptMethodBinding.invoke(JavaScriptMethodBinding.java:126)
at com.ibm.xsp.extlib.component.rest.CustomService$ScriptServiceEngine.renderServiceGet(CustomService.java:311)
at com.ibm.xsp.extlib.component.rest.CustomService$ScriptServiceEngine.renderService(CustomService.java:262)
... 20 more
Caused by: com.ibm.jscript.InterpretException: Script interpreter error, line=11, col=14: [ReferenceError] 'compositeData' not found
Is there a way to use composite to create my JSON object?
I’m trying to create an object like this:
var object = {};
object.height = compositeData.height
return toJson(object)
The REST Control should be considered as an independent component that has no direct access to the page on which it exists because it is possible to call the REST service via a url similar to
database.nsf/page.xsp/RESTServiceName.what you should do instead is call your REST service with a url that includes parameters to pass into the control such as
database.nsf/page.xsp/RESTServiceName?height=20&width=50and then reference them within the control usingparam.get("height")andparam.get("width").Another option could be to put the parameters into a scope variable and read them from there.