I have created an xPages application which uses a lot of server side javascript code functions located in a server side javascript library.
Now I have some java code located in the java design element which I would like to use to call the javascript functions.
I do understand that it is not logical to call javascript from java, but I guess that all server side javascript is compiled to java, so I was thinking that it might be possible to get a handle to the compiled java class that was generated.
any ideas?
Toby Samples
You can create a value binding,
ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{javascript:getData()}");
System.out.println(vb.getValue(FacesContext.getCurrentInstance()).toString());
This would call the getData()
method from your SSJS library.
来源:https://stackoverflow.com/questions/9099093/calling-ssjs-from-java