动网论坛,站长建站首选,国内使用量最多的论坛软件 动网论坛官方技术讨论区 站长工具 申请属于您自己的免费论坛
首页 | 新闻资讯 | 网站运营 | 网络编程 | 数据库 | 服务器 | 网页设计 | 图像媒体 | 网络应用 | 搜索优化 | 资源下载 | 动网主机 | DVBOX
    本站内  互联网 ASP论坛  ASP.Net论坛  PHP论坛
   Asp → 阅读文章

 在ASP中使用Java类(Using Java Classes from ASP)

作者来源: 
阅读 3193 人次 , 2000-12-29 

Using Java Classes from ASP

COM components aren't the only way to use compiled code in your ASP applications. If you're familiar with
Java, but have no way of wrapping your classes as COM objects (for example, you use JDK or J++ Standard),
you can still use java from ASP. And here's how

First, make sure you have access to the C:\<WINDIR>\java\trustlib\ directory on your production server.
Most shared hosting plans wouldn't allow this kind of access, but if you're developing an intranet, or a
site for dedicated server deployment, you'll be just dandy.

Next step, compile your java class as you would compile an applet or console class, using your favourite
compiler, any one will do, and remember to jot down the names of the public methods and properties your
class makes available.

Drop your class file into the \trustlib\ folder, and make sure you have a recent Java Virtual Machine
installed on the server. the latest MS version is here.

Now to call the class from your ASP pages, use the following syntax

set myJavaObject = GetObject("java:classname")
So if you compiled your class as 'foobar.class', you use

set myJavaObject = GetObject("java:foobar")
Generally, the performance of a java class used like this is slightly slower than a COM dll, but faster
than just scripting, and you also have easy access to the inbuilt java class libraries, some of which
you'll find VERY useful in your ASP apps.

Finally, call methods of the object as you would call methods of any other COM component

Happy coding
  

 
 收藏本文  打印本文  论坛讨论  关闭窗口
· 上一篇:ASP数据库事务处理
· 下一篇:用划界字符列表来得到字符所在串的位置(ListFind函数)
· Asp Object 之:Response.Cookies
· 无组件上传图片到数据库中,最完整解决方案
· 站内搜索脚本例子四(JavaScript)
· xmlHTTP技术资料
· JScript 方法 - escape 方法


关于本站 | 联系我们 | 业务合作 | 客户案例 | 诚聘英才 | 广告合作 | 收藏本站
海口动网先锋网络科技有限公司版权所有
Copyright © 2000 - 2006 Cndw.Com
中华人民共和国电信与信息服务业务经营许可证编号 琼 ICP 020077