Library tutorials & articles

Using Components and Objects in ASP

Creating objects from a java class

To use Server.CreateObject to create an instance of a Java class, you must use the JavaReg program to register the class as a COM component. You can then use Server.CreateObject method or an HTML <OBJECT> tag with the PROGID or CLSID. Alternatively, you can use the mechanism provided by Java monikers to instantiate the Java class directly without using the JavaReg program. To instantiate a class with monikers, use the VBScript or JScript GetObject statement and provide the full name of the Java class in the form java:classname. The following VBScript example creates an instance of the Java Date class.

<%
Dim dtmDate
Set dtmDate = GetObject("java:java.util.Date")

Response.Write "The date is " & dtmDate.toString()
%>

Objects created by calling GetObject instead of Server.CreateObject can also access the ASP built-in objects and participate in a transaction. To use Java monikers, however, you must be using version 2.0, or later, of the Microsoft virtual machine.

Comments

  1. 22 Feb 2004 at 23:46
    In an interview, they asked me what are the components of ASP and VB. Can any body help me?.
  2. 17 Jul 2002 at 08:02

    If you want to try using components, start using those allready installed on your server. Use this script to check your IIS for installed components:
    http://www.bier-voting.de/objcheck/
     

  3. 01 Jan 1999 at 00:00

    This thread is for discussions of Using Components and Objects in ASP.

Leave a comment

Sign in or Join us (it's free).

Talal Ahmed Siddiqui
AddThis

Related podcasts

  • Scott Guthrie

    Scott catches up with Scott Guthrie in an interview covering Ajax, Asp 2.0, extender controls, CSS adapters and more.

We'd love to hear what you think! Submit ideas or give us feedback