如何在网页中调用嵌入式java函数

问题描述:

这是我想在网页中使用的功能,并希望在脚本节点中将其作为其他javascript函数调用。但是,请你指导我如何实现它。

Here is the function that i want to use in a web page and want to call it in script node as other javascript functions. But could you please guide me on how to achieve it.

public static String getClipboard() {

    Transferable t = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null);

    try {
        if (t != null && t.isDataFlavorSupported(DataFlavor.stringFlavor)) {
            String text = (String)t.getTransferData(DataFlavor.stringFlavor);
            return text;
        }
    } catch (UnsupportedFlavorException e) {
    } catch (IOException e) {
    }
    return null;
}

我对这个概念完全陌生..如果你能回答这个问题,这将是非常有用的..
谢谢

I am completely new to this concept.. If you can answer this question, that will be very helpful.. Thanks

使用 LiveConnect ,用于在页面内实现Java和JavaScript之间的双向通信。

Use LiveConnect to enable bidirectional communication between Java and JavaScript within a page.