在java小程序中打印和保存文件
我们有这样的问题:我们想在浏览器中从java applet保存文件或打印,但这不容易实现,因为java applet似乎没有调用操作系统服务的权限。有什么方法可以实现这两个功能(也许需要服务器帮助等)。你有什么建议? 先感谢您
we have this problem: we want to save files or print from java applet in browser, but this could not be easily implemented, as java applets don't seem to have rights for calling OS services. Is there any way to implement these two functionalities (maybe with server help etc.). What would you suggest?
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要访问 Applet 沙箱之外的资源,您需要对 Applet 进行签名,并在策略文件中设置访问权限。
在这里您可以找到有关 Applet 安全性的相当完整的指南。
For accessing resources outside the Applet sandbox, you'll need to sign your Applet, and set up the access privilieges at a policy file.
Here you can find a quite complete guide on Applets Security.
嗯,解决方案非常简单:)。在 Netbeans 中 ->项目属性->应用程序/Web Start/{选中自签名复选框}。所有认证就是这样
Well the solution was very simple :). In Netbeans -> Project properties -> Application/Web Start/{check the self-signed checkbox}. That's it with all certifications
托马斯是对的。但也许我可以建议你一个解决方法。您可以通过浏览器实现打印。这不需要额外的安全权限,并且小程序可能未签名。
要从小程序调用 javascript API,小程序必须具有属性 MAYSCRIPT 并使用 netscape.javascript.JSObject。是的,网景!这个名字仍然作为这位死去的浏览器的纪念碑。
Tomas is right. But probably I can suggest you a workaround. You can implement your print through browser. This does not require additional security permissions and applet might be unsigned.
To call javascript API from applet the applet must have attribute MAYSCRIPT and use netscape.javascript.JSObject. Yes, netscape! The name remained as a monument for this died browser.