运行applet时出现无法载入class的问题,以及设置codeBase

最简单的方法就是:把它们放在同一个目录就不用设置啦。。。,但是,不方便管理,这是最次的做法啊,不可取了。

 


把jsp和applet放在同一目录是可以解决此问题,但是不利于文件的分类管理  
  而且分开放的话,codebase="../web-inf/class/abc/"也是不对的  
  因为codebase是URL  
  This   OPTIONAL   attribute   specifies   the   base   URL   of   the   applet--the   directory   that   contains   the   applet's   code.   If   this   attribute   is   not   specified,   then   the   document's   URL   is   used.    
   
  我现在已经找到原因,  
  applet的class文件不能放在web-inf目录下,  
  因为这是个特殊目录,所以http://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>  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值