简体   繁体   English

无法找到Applet类错误

[英]Applet Class Not Found Error

i have just started learning jsp, i came across running Applet from jsp, the code below doesn't seems to work. 我刚刚开始学习jsp,我偶然发现从jsp运行Applet,下面的代码似乎不起作用。

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>InfoVisual</title>
    </head>
    <body>
    <jsp:plugin type="applet"  codebase="WEB-INF/classes" code="DemoApplet.class"  width="400" height="400">
      <jsp:fallback>
       <p>Unable to load applet</p>
       </jsp:fallback>
    </jsp:plugin>
        <input name="btnShow" value="Show" type="submit">
    </body>
</html>

My eclipse project structure is like below 我的Eclipse项目结构如下

在此处输入图片说明

I don't know why i can't see the applet running. 我不知道为什么我看不到小程序运行。 Have i placed files in right folders??? 我是否将文件放置在正确的文件夹中???

Classes in WEB-INF/classes are only visible to server-side code such as servlets. WEB-INF/classes仅对服务器端代码(例如Servlet)可见。 Instead create a JAR file containing the compiled classes required to run the applet are place them in the same location as the JSP file. 而是创建一个包含运行该applet所需的已编译类的JAR文件,并将其放置在与JSP文件相同的位置。 The plugin tag will then look like 然后,plugin标签看起来像

<jsp:plugin type="applet"  code="DemoApplet.class" archive="MyAppletJar.jar" width="400" height="400">
  <jsp:fallback>
   <p>Unable to load applet</p>
   </jsp:fallback>
</jsp:plugin>

this code worked perfectly: 这段代码完美地工作了:

<applet code="DemoApplet.class" name="DemoApplet" archive="DemoApplet.jar" width=300 height=300>
</applet>

and here is my project structure: 这是我的项目结构:

在此处输入图片说明

Thanx for the help :)) 感谢您的帮助:))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM