如何在网页中调用嵌入式java函数 [英] How to call embedded java function in a web page

查看:75
本文介绍了如何在网页中调用嵌入式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.

这篇关于如何在网页中调用嵌入式java函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆