In my project I have an HTML document that is displayed in a JavaFx WebView. I have a Javascript function that should call the Java method getData (currently it only prints the passed variable so that I can confirm the data is being passed from the WebView back to the Java application):
public void getData(String s){
System.out.println(s);
}
This is how I am attempting to add the functionality to call Java methods into my WebView webpage:
JSObject win = (JSObject) webEngine.getDocument();
win.setMember("app", new Bridge());
And here is the JavaScript function that I'm using to call getData:
function interOp(val){
app.getData(val);
}
This function is called on the onchange event on a <select> tag. The guides I have followed seem to do exactly this, however when I run my program nothing is printed on the console.