开发者

Accessing applet code from JSP

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜