Calling SSJS with Java?

I created an xPages application that uses many server-side javascript functions located in the server-side javascript library.

Now I have java code located in a java design element that I would like to use to call javascript functions.

I understand that it is not logical to call javascript from java, but I think that all server-side javascript is compiled in java, so I thought that it would be possible to get a handle to the compiled java class that was generated.

any ideas?

+4
source share
1 answer

You can create a value binding,

ValueBinding vb = FacesContext.getCurrentInstance().getApplication().createValueBinding("#{javascript:getData()}"); System.out.println(vb.getValue(FacesContext.getCurrentInstance()).toString()); 

This will call the getData() method from your SSJS library.

+14
source

Source: https://habr.com/ru/post/1394210/


All Articles