Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write ASP components with Java

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces how to use Java to write ASP components, the article is very detailed, has a certain reference value, interested friends must read it!

ASP makes it infinitely scalable through ActiveX Server Components (ActiveX server components). In ASP development, it is inevitable to use components, there are indeed a lot of free, trial components on the Internet, but these are other people's things, and you can't help but worry about using them. ActiveX Server Component can be written in programming languages such as Visual Basic, Delphi, Java, Visual C++, COBOL, etc. This article focuses on how to use Java to write ASP components.

Write a very simple Java program first.

Public class TestJava

{

Public String Ver= version 1.0.1

Public int lenstr (String str)

{

Return str.length ()

}

Public String Version ()

{

Return Ver

}

}

Compile and generate TestJava.class, and then register it as a component.

Register the Java component:

Maybe most people think of RegSvr32.exe, but it is not used here. It is used to register ActiveX components compiled into DLL. Class files written by Java cannot be registered with it. What you need is JavaReg.exe, which can be found in microsoft SDK for java. You install microsoft sdk for java first. The latest version is version 4. 0. Download address:

DOWNLOAD.microsoft.com/download/javasdk/install/4.0/win98/en-us/SDKJava40.exe "> Mricrosoft SDK for Java 4.0

If there is a mistake, go to http://www.microsoft.com to find it yourself. Download and install it directly.

This tool is available in the bin directory of Microsoft SDK for java after installation. Before registering, you can copy the compiled class file to the javatrustlib directory in the system directory (C:winntjavatrustlib on my computer). Enter JavaReg under the Command prompt window and execute it, and you may see its usage and parameters.

Such as:

Javareg / register / class: TestJava / progid: component .TestJava

Register the class file generated above

You can use the Chinese name. Reverse register javareg / unregister... Just do it. Note: if your Java has been recompiled and you want to take effect immediately, you must restart the web server so that it can be used properly, otherwise you will find that the newly added method does not work.

Use in ASP:

The results are as follows:

fifteen

Version 1.0.1

Version 1.0.1

Note: this Java program can only be compiled successfully using the microsoft sdk for java compiler (using jvc.exe), and there are detailed examples of ASP under SamplesASP in the microsoft sdk for java installation directory.

The above is all the content of the article "how to write ASP components in Java". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report