从java Web start应用程序返回值

时间:2023-01-19 15:28:33

Wondering if anyone knows if there is a way to "return" something from a java web start application into the code on the website. For example say the user needed to select a location in the java application. This would then pass the location value back to the code on the webpage (which is php and javascript). I have figured out how to pass arguments into a program, but so far cannot figure out any way to get them out after much googling. Any help would be much appreciated, thanks.

想知道是否有人知道是否有办法从java web start应用程序“返回”某些东西到网站上的代码中。例如,假设用户需要在java应用程序中选择一个位置。然后,这会将位置值传递回网页上的代码(即php和javascript)。我已经想出如何将参数传递给一个程序,但到目前为止还无法找到任何方法在google搜索后将它们删除。任何帮助将不胜感激,谢谢。

2 个解决方案

#1


0  

In principle no, since the Webstart application can be running without any Website open at all.

原则上不行,因为Webstart应用程序可以在没有任何网站打开的情况下运行。

But if your clients use the Java-plugin from 1.6.0_10 or later (and not Safari and some other browsers with special Java-handling), you can use a JNLP-enabled applet, which is able to do the same things as a Webstart application (i.e. loading files and such), and is always bound to a webpage. It then can use the Javascript-bridge, or simply a loadDocument with the right parameters to feed back information.

但是,如果您的客户使用1.6.0_10或更高版本的Java插件(而不是Safari和其他具有特殊Java处理功能的浏览器),您可以使用支持JNLP的applet,它可以执行与Webstart相同的操作。应用程序(即加载文件等),并始终绑定到网页。然后它可以使用Javascript-bridge,或者只是使用具有正确参数的loadDocument来反馈信息。

#2


0  

You can use URL or sockets to connect back to the "same-origin" host. You can also use BasicService to open a web page, possibly from a different server, in a browser (although this shouldn't be used to send information back, as it'll be a GET not a POST).

您可以使用URL或套接字连接回“同源”主机。您还可以使用BasicService在浏览器中打开可能来自不同服务器的网页(虽然这不应该用于发回信息,因为它将是GET而不是POST)。

#1


0  

In principle no, since the Webstart application can be running without any Website open at all.

原则上不行,因为Webstart应用程序可以在没有任何网站打开的情况下运行。

But if your clients use the Java-plugin from 1.6.0_10 or later (and not Safari and some other browsers with special Java-handling), you can use a JNLP-enabled applet, which is able to do the same things as a Webstart application (i.e. loading files and such), and is always bound to a webpage. It then can use the Javascript-bridge, or simply a loadDocument with the right parameters to feed back information.

但是,如果您的客户使用1.6.0_10或更高版本的Java插件(而不是Safari和其他具有特殊Java处理功能的浏览器),您可以使用支持JNLP的applet,它可以执行与Webstart相同的操作。应用程序(即加载文件等),并始终绑定到网页。然后它可以使用Javascript-bridge,或者只是使用具有正确参数的loadDocument来反馈信息。

#2


0  

You can use URL or sockets to connect back to the "same-origin" host. You can also use BasicService to open a web page, possibly from a different server, in a browser (although this shouldn't be used to send information back, as it'll be a GET not a POST).

您可以使用URL或套接字连接回“同源”主机。您还可以使用BasicService在浏览器中打开可能来自不同服务器的网页(虽然这不应该用于发回信息,因为它将是GET而不是POST)。