开发者

Accessing applet code from JSP

开发者 https://www.devze.com 2023-03-04 16:01 出处:网络
I am unable to access the applet from my local. I m getting the below exception java.lang.Exception: FILELOCATIONGENR:java.security.AccessControlException: access denied (java.util.PropertyPermission

I am unable to access the applet from my local. I m getting the below exception

java.lang.Exception: FILELOCATIONGENR:java.security.AccessControlException: access denied (java.util.PropertyPermission user.dir read)

I tried to edit the java.policy file also, but still no use. your help will开发者_运维技巧 be greatly appreciated. thank you.


The only way for that is using JavaScript. Assuming that you've the following method in the Applet class

public String getFoo() {
    return "foo";
}

and the Applet is embedded in JSP as follows

<applet name="appletname" ...>

then you can access it in JS as follows

var foo = document.appletname.getFoo();
// ...

See also:

  • The Java Tutorials - Applets - Invoking Applet methods from JavaScript

The exception which you got however indicates an entirely different problem. You're trying to access the user home directory from inside an unsigned applet. This has nothing to do with JSP - Applet communication.

0

精彩评论

暂无评论...
验证码 换一张
取 消