jsp中嵌入applet找不到类

 

各位,本人的问题具体是这样的:
我用的是eclipse+tomcat
jsp页面与applet的class文件的路径关系是这样的:
-工程名/src/com/model/logic/SoundCalling.java(applet路径)
-工程名/WebRoot/jsp页面
-工程名/WEB-INF/classes/com/model/logic/SoundCalling.class

我的jsp页面中用下面两种方法来写都不行,都会报错,说找不到类:
<jsp:plugin type="applet" code="WEB-INF.classes.com.model.logic.SoundCalling.class" height="200" width="200"/>   
<jsp:plugin type="applet" code="com.model.logic.SoundCalling.class" height="200" width="200" codebase="WEB-INF/classes"/> 


报错信息:  
载入:找不到类 WEB-INF.classes.com.model.logic.SoundCalling.class。
java.lang.ClassNotFoundException: WEB-INF.classes.com.model.logic.SoundCalling.class
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
Exception in thread "Thread-8" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.runLoader(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletStatus(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception in thread "thread applet-WEB-INF.classes.com.model.logic.SoundCalling.class" java.lang.NullPointerException
at sun.plugin.util.GrayBoxPainter.showLoadingError(Unknown Source)
at sun.plugin.AppletViewer.showAppletException(Unknown Source)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)


(注:浏览器上面的设置也没问题,选定了applet项:1.5.0_06jre用于applet)
请问一下该如何解决。拜托各位大虾了~~很急,非常感谢!

 回复内容
【For_suzhen】:
看不出问题来,是不是classpath设置的问题

【xyf_84】:
WEB-INF下不可访问。

【xyf_84】:
<jsp:plugin type="applet" code="com.model.logic.SoundCalling.class" height="200" width="200" codebase="com.model.logic"/> 这样呢?

【lanseliuying】:
<jsp:plugin type="applet" code="com.model.logic.SoundCalling.class" height="200" width="200" codebase="../classes"/>

【lanseliuying】:
<jsp:plugin type="applet" code="com.model.logic.SoundCalling.class" height="200" width="200" codebase="/WEB-INF/classes"/> 


【lanseliuying】:
转载=================
applet的class文件最好不要放在web-inf目录下,因为这是个特殊目录,所以ttp://localhost:8080/test/servlet/不能找到applet1.class这个文件。  


可以在/webapps/test/下新建1个文件夹,将applet的class文件放在里面,在重新设置codebase属性  

例如:  

目录结构  
    测试用的jsp     /webapps/test/jsp/test.jsp  
    jsp中插入的applet的class       /webapps/test/applet/abc/Applet1.class  
URL  
    http://localhost:8080/test/jsp/test.jsp  

test.jsp中的部分代码  
    <jsp:plugin   type="applet"   code="abc.Applet1.class"  
                            width="475"   height="350"   codebase="/test/applet/">  
        <jsp:params>  
            <jsp:param   name="MESSAGE"   value="Your   Message   Here"   />  
            </jsp:params>  
    </jsp:plugin>

 

 

转载于:https://www.cnblogs.com/jackyyang7/articles/2780183.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值