当前位置: 移动技术网 > IT编程>开发语言>.net > 手把手教你使用Java来编写ASP组件(2)

手把手教你使用Java来编写ASP组件(2)

2019年01月22日  | 移动技术网IT编程  | 我要评论

cfrpk盘龙,铲齿鹿肋排,伤感爱情日记

5、 双击javaasp.java,会出现一个代码框,把下面的代码输入代码框,并保存。

  import com.ms.iis..*;
  import com.ms.mtx.*;

  这两句应当出现在程序的最前面,它们是导入命令,导入我们在工程中需要用到的某些java类的包,我下面给出完整的程序

/** * this class is designed to be packaged with a com dll output format. * the class has no standard entry points, other than the constructor. * public methods will be exposed as methods on the default com interface. * @com.register ( clsid=ade14872-9cf6-42a0-a8f2-7a571e51a840, typelib=5e11d496-7229-4283-a40b-139e05def44c ) */ //上面我们看到一个clsid,它是用来标记微软com所用的。

import com.ms.iis.asp.*;//导入两个包

import com.ms.mtx.*;

public class javaasp
{

 public boolean helloworld()

 {
  response newres = aspcontext.getresponse();//创建一个response
  newres.write("hello world,maybe it is your first javaasp com!");
  return true;
 }

}

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网