我首先建立一个ex7-11.jsp文件,内容如下<%@ page contentType="text/html; charset=GB2312"%>
<html>
<head>
<title>
用&lt;jsp:plugin&gt;加载Applet
</title>
</head>

<body>
<center>
<font size="3" face="隶书" color="blue">
用&lt;jsp:plugin&gt;加载Applet
</font>
<!-- 用plugin加载Applet -->
<hr />
<jsp:plugin type="applet" code="RollingMessage.class" height="60" width="550">
</jsp:plugin>
</center>
</body>
</html>然后建立一个RollingMessage.java,内容如下:import java.awt.*;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;public class RollingMessage extends java.applet.Applet implements Runnable
{
Thread runThread;
String s = "欢饮学习\"Web技术应用基础\"!";
int s_length = s.length();
int x_character = 0;
Font wordFont = new Font("楷体_GB2312", Font.BOLD, 30);

public void start()
{
if (runThread == null)
{
runThread = new Thread(this);
runThread.start();
}
}

public void stop()
{
if (runThread != null)
{
runThread.stop();
runThread = null;
}
}

public void run()
{
while (true)
{
if (x_character++ > s_length)
{
x_character = 0;
}
repaint();
try
{
Thread.sleep(300);
}
catch (InterruptedException e)
{}
}
}

public void paint(Graphics g)
{
g.setFont(wordFont);
g.setColor(Color.BLUE);
g.drawString(s.substring(0, x_character), 8, 50);
}

public static void main(String[] args)
{
Frame f = new Frame("动画程序");
RollingMessage drawTest = new RollingMessage();
drawTest.init();
drawTest.start();
f.add("Center", drawTest);
f.resize(400, 100);
f.show();
}
}然后生成RollingMessage.class,将ex7-11.jsp和RollingMessage.class都放到webapps/test/目录下
然后在浏览器中输入http://localhost:8080/test/ex7-11.jsp
但是显示的结果中没有显示出applet
结果如图所示:
我想知道在jsp中加载Applet应该怎么做,好像书上说的也不是很清楚,上面的这个例子不能正常运行,在此向大家求助