如何在APPLET中读入 HTTP中将其他网页的内容

newerz 2002-03-20 12:21:50

我写了下面程序,写到APPLET中出现下面错误.但将这个程序写到纯JAVA编译后运行CLASS就没错.

1-2---java.security.AccessControlException: access denied (java.net.SocketPermis
sion 192.168.90.1:80 connect,resolve)



URL url;
InputStream iss;
int i;
long lSize,lTime=0;
byte[] byteArr;
String ss;
String stemp="0";
URLConnection uc;
try
{
stemp="1";
url = new URL("http://192.168.90.1/test/getTime.jsp");
stemp = "1-1";
uc = url.openConnection();


stemp = "1-2";
iss = uc.getInputStream();
stemp="2";
iss = url.openStream();
stemp="3";
lSize = iss.available();
stemp="4";
byteArr = new byte[(int)lSize - 1];
stemp="5";
iss.read(byteArr,0,(int)lSize -1);
ss = new String(byteArr);
System.out.println (ss);
lTime = Long.parseLong(ss);
}catch(Exception e)
{
System.out.println (stemp+"---"+e.toString());
}
...全文
80 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
wes109 2002-03-20
  • 打赏
  • 举报
回复
是applet的权限问题!
lliang2 2002-03-20
  • 打赏
  • 举报
回复
你得先给applet授权。
llkh 2002-03-20
  • 打赏
  • 举报
回复
禁止访问
newerz 2002-03-20
  • 打赏
  • 举报
回复
除了这种方法.
服务器上的数据,有什么办法传送到APPLET上去.
IMarksman 2002-03-20
  • 打赏
  • 举报
回复
天极网有一篇不错文章,可以借鉴一下!
http://www.yesky.com/20010919/197664.shtml
gularess 2002-03-20
  • 打赏
  • 举报
回复
给Applet签名。
参见sun的教程。

23,404

社区成员

发帖
与我相关
我的任务
社区描述
Java 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧