VBScript


Настройка примера
Запуск примера

Данный пример является приложением VBScript и требует Windows Script версии 5.1 или позднее. Получить подробную информацию о Windows Script и загрузить его можно на сайте http://msdn.microsoft.com/scripting.

Настройка примера

пример не требует никакой настройки.

Запуск примера

Данный пример представляет из себя консольное приложение. Для его запуска воспользуйтесь поставляемым пакетным файлом.

Ниже приведена инструкция запуска:

  1. Откройте консоль.
  2. Перейдите в следующий каталог:
  3. Запустите пакетный файл XJBExamples.bat.

Ниже приведен пример вывода примера, завершившего работу без ошибок:

D:\WebSphere\Appclient\samples\bin\ActiveXBridgeClients\VBScript\XJBExamples>xjbexamples.bat
----------------------------------------------------
Running XJBExamples.wsf
----------------------------------------------------

Microsoft (R) Windows Script Host Version 5.1 for Windows
Copyright (C) Microsoft Corporation 1996-1999. All rights reserved.

Creating XJB environment
Checking to see if EAR file is already extracted.
  It is.  Attempting to remove the extracted EAR directory.
     EAR Rremoved successfully
J2EE Creating Client Container
IBM WebSphere Application Server, Release 6.0
J2EE Application Client Tool
Copyright IBM Corp., 1997-2004

WSCL0013I: Initializing the J2EE Application Client Environment.
Debugging is set to false
Loading the Security Configuration...
WSCL0035I: Initialization of the J2EE Application Client Environment has completed.
Checking to see if the jvmrunning system property is already set
  Not set, so the JVM wasn't already running

--------------------------------------------
 VB Date to Java Date Sample
--------------------------------------------
Converting VB Date to Java Date.
VB Date = 3/28/1970 9:34 PM
Creating a GregorianCalendar object
Retrieving a Date object from our initialized GregorianCalendar object
Retrieving the String represntation of our Date
Java Date = Sat Mar 28 21:34:00 CST 1970

--------------------------------------------
 Java Date to VB Date Sample
--------------------------------------------
Converting Java Date to VB Date.
Java Date = 12/18/1966 12:00 PM
Creating a DateFormat object for the default locale
Using the DateFormat object to parse the input date (12/18/1966 12:00 PM) to a Date object
Retrieving a GregorianCalendar object from Calendar.getInstance()
Setting the GregorianCalendar objects date/time to our date object
Initializing a VB Date object by using the GregorianCalendar YEAR, MONTH, etc. properties
VB Date = 12/18/1966 12:00:00 PM

--------------------------------------------
 VB String to Java Character Sample
--------------------------------------------
Converting VB String to Java Character.
VB String = z
Adding the input string to a JMethodArgs object and coercing it to a Char
Initializing a new Character object with the JMethodArgs object container
Retrieving the charValue() from our Java Character object.
Java Character = z

--------------------------------------------
 Java Character to VB String Sample
--------------------------------------------
Converting Java Character VB String.
Java Character = z
Adding the input string to a JMethodArgs object and coercing it to a Char
Initializing a new Character object with the JMethodArgs object container
Retrieving the String representation from our Java Character object.
VB String = z

--------------------------------------------
 VB Long Long String to Java Long Sample
--------------------------------------------
Converting String to Java Long using Currency type.
VB Currency = 9223372036854775807
Converting the input text number to a Currency type
Creating a java Long object using our currency type to initialize it
Calling Java Long.toString()
Java Long = 9223372036854775807

--------------------------------------------
 Java Long to VB Sample
--------------------------------------------
Converting String to Java Long using Java Parser.
VB Currency = 9223372036854775807
Creating a java.lang.Long, initializing it with our input String
Retrieving the long (currency) value from the Long
Converting the Currency value to a string
Java Long = 9223372036854775807

--------------------------------------------
 Iterator Sample
--------------------------------------------
Building Array for Java to iterate through...
Input list:
Apples
Oranges
Bananas
Grapefruit
Kiwi
Grapes
Strawberries
Raspberries

Creating a Java Vector
Adding the items to the Vector
Retrieving the Vector iterator
Iterating through the iterator and adding items to the output list

Output list:
Apples
Oranges
Bananas
Grapefruit
Kiwi
Grapes
Strawberries
Raspberries


--------------------------------------------
 Multi dimensional Array Sample
--------------------------------------------
Creating a 2D Array of Strings in VB
Creating our ActiveXBridgeExamples_Arrays Java test object.
Assigning our array to a method in our test object
Retrieving the array from our test object as String[][]
Retrieving the array from our test object as Object
VBScript Array Results:
(0, 0) Tom
(0, 1) Dick
(0, 2) Harry
(1, 0) Amy
(1, 1) Liz
(1, 2) Monica
(2, 0) Fido
(2, 1) Rex
(2, 2) Buttons


Java Array Results:
[0,0]Tom
[0,1]Dick
[0,2]Harry
[1,0]Amy
[1,1]Liz
[1,2]Monica
[2,0]Fido
[2,1]Rex
[2,2]Buttons


--------------------------------------------
 Resource ENV Ref Sample
--------------------------------------------
Retrieving ENV Ref: url/WebSphereHomePage
Getting the javax.naming.InitialContext
Lookup java:comp/env/url/WebSphereHomePage
ENV Ref =           http://www.ibm.com/websphere

Retrieving ENV Ref: url/IBMHomePage
Getting the javax.naming.InitialContext
Lookup java:comp/env/url/IBMHomePage
ENV Ref =           http://www.ibm.com

Retrieving ENV Ref: ExampleEnvEntry
Getting the javax.naming.InitialContext
Lookup java:comp/env/ExampleEnvEntry
ENV Ref =           This is a sample Environment Entry