JavaScript Interaction
You can make JavaScript calls from the server-side with the execute() method in the JavaScript class. You can get a JavaScript instance from the current Page object with getJavaScript().//TODO Check that the API is so.
Java
Java
The JavaScript is executed after the server request that is currently processed returns. If multiple JavaScript calls are made during the processing of the request, they are all executed sequentially after the request is done. Hence, the JavaScript execution does not pause the execution of the server-side application and you can not return values from the JavaScript.
Handling JavaScript Function Callbacks
Java
Parameters passed to the JavaScript method on the client-side are provided in a JSONArray passed to the call() method. The parameter values can be acquired with the get() method by the index of the parameter, or any of the type-casting getters. The getter must match the type of the passed parameter, or an exception is thrown.
The function callback mechanism is the same as the RPC mechanism used with JavaScript component integration, as described in .