<!-- PLUGIN.jsp -->
<%@ page contentType="text/html; charset=GB2312"%>
<%@ page language="java" %>
<HTML>
<HEAD>
<TITLE>用<jsp:plugin>加载Applet</TITLE>
</HEAD>
<BODY>
<CENTER>
<FONT SIZE = 5 COLOR = blue>用<jsp:plugin>加载Applet</FONT>
</CENTER>
<BR>
<HR>
<BR>
<CENTER>
<!-- 用plugin加载applet -->
<jsp:plugin type="applet" code="HelloWorld.class" height="40" width="320" >
<jsp:params>
<jsp:param name="name" value="jsp"/>
</jsp:params>
<!-- 如果无法载入Applet时显示的信息 -->
<jsp:fallback>无法加载Applet</jsp:fallback>
</jsp:plugin>
</CENTER>
</BODY>
</HTML>
其中,HelloWorld.java内容如下:
import java.applet.Applet;
import java.awt.Graphics;
public class HelloWorld extends Applet
{
String name;
public void init()
{
name = getParameter("name");
}
public void paint(Graphics g)
{
g.drawString(" This demo show jsp:plugin usage,the " + name + " is <br> a parameter!", 60, 25);
}
}