初学jsp导入applet 文件出错问题!急!!!

chianti_2019 2004-09-01 12:16:01
applet 错误-------------
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%//@ page import="hello.hello" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>学习java</title>
<jsp:useBean id="hw" scope="session" class="hello.hello"></jsp:useBean>
<font color="#FF3366"><%=hw.getString()%></font>
<br>
<%hw.setString="hello word !!!"%>
<br>
<font color="#CC9966">你hao ma 吗?<%=hw.getString()%></font>
<applet code="helloworld" width="156" height="80"></applet>
真的这个applet就不可以用吗?
</body>
</html>
我的applet 文件是安装tomcat的带的,应该程序没问题,就是可能我的配置,tomcat的问题吧,说实话我真的不会配
到现在还没搞定,真的太麻烦了,都是老板急这要我把网站改版用jsp做我也没办法。哭:
我的bean文件:
import java.applet.*;
import java.awt.Graphics;
import java.awt.Font;
public class helloworld extends Applet
{
public void paint(Graphics g)
{
String s;
Font font;
s="hello world1";
font=new Font("TimesRoman",Font.BOLD,40);
g.setFont(font);
g.drawString(""+s,20,100);

}

}

我的运行错
:
载入:找不到类 helloworld。java.lang.ClassNotFoundException: helloworld at

sun.applet.AppletClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown

Source) at sun.applet.AppletClassLoader.loadCode(Unknown Source) at

sun.applet.AppletPanel.createApplet(Unknown Source) at sun.plugin.AppletViewer.createApplet(Unknown

Source) at sun.applet.AppletPanel.runLoader(Unknown Source) at sun.applet.AppletPanel.run(Unknown

Source) at java.lang.Thread.run(Unknown Source)Caused by: java.io.IOException: open HTTP connection

failed. at sun.applet.AppletClassLoader.getBytes(Unknown Source) at

sun.applet.AppletClassLoader.access$100(Unknown Source) at sun.applet.AppletClassLoader$1.run(Unknown

Source) at java.security.AccessController.doPrivileged(Native Method) ... 10 more

哭死了,到现在已经2个星期了,一点进步都没有,
连环境都弄的我晕。 请大俠们帮帮忙!!!
谢谢了。咳。。。。
...全文
115 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
chianti_2019 2004-09-01
  • 打赏
  • 举报
回复
我可以了,我不是你那样的,我把helloword 放在jsp页面的同个目录就可以了。
你说的我也不了解要建立文件夹还要建立一个包是吧。???
stonecsdn 2004-09-01
  • 打赏
  • 举报
回复
当然前提helloworld 的包是hello
stonecsdn 2004-09-01
  • 打赏
  • 举报
回复
简单一点:
在jsp文件的同一级目录下建立hello目录,在hello目录中放helloworld .class,页面修改如下:

<applet code="hello.helloworld .class" width="156" height="80"></applet>

steveyue 2004-09-01
  • 打赏
  • 举报
回复
如果还是上次的那个类的话helloworld改成hello另外加上路径
anruky 2004-09-01
  • 打赏
  • 举报
回复
好像不是applet的原因,而是你bean找不到
csm2432 2004-09-01
  • 打赏
  • 举报
回复
upup
wtiancai 2004-09-01
  • 打赏
  • 举报
回复
代码太长了,看的太累

81,122

社区成员

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

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