Values passed in from VBS or JScript to Java always String


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Values passed in from VBS or JScript to Java always String

  1. #1
    Gary Guest

    Values passed in from VBS or JScript to Java always String


    When I attempt to pass a numeric value from VBScript or JavaScript into a
    Java COM dll by calling an overloaded functions i.e. String func1 (int i)
    OR String func1 (String str) the String func1 (String str) is always invoked.
    I don't understand why.

    ASP CODE
    --------

    func1(1)

    Java Overload Functions
    -----------------------

    private String func1(String FldName)
    {
    int index = 0;
    index = Row.column_name.indexOf(FldName);
    return(((Vector)Row.column_value.elementAt(this.curRecPointer)).elementAt(index).toString( )
    );
    }

    private String func1(int index)
    {
    if (index > Row.column_name.size())
    {
    this.Error = -1;
    this.ErrDescription = "Field Index out of bounds";
    return ("");
    }
    else return(((Vector)Row.column_value.elementAt(this.curRecPointer)).elementAt(index).toString( )
    );
    }

  2. #2
    John Timney (MVP) Guest

    Re: Values passed in from VBS or JScript to Java always String

    because asp only uses loosely defined types called variants which com can
    interprit as string.

    Regards

    John Timney (MVP)

    Gary <gary.frick@compaq.com> wrote in message
    news:392dd1ce$1@news.devx.com...
    >
    > When I attempt to pass a numeric value from VBScript or JavaScript into a
    > Java COM dll by calling an overloaded functions i.e. String func1 (int i)
    > OR String func1 (String str) the String func1 (String str) is always

    invoked.
    > I don't understand why.
    >
    > ASP CODE
    > --------
    >
    > func1(1)
    >
    > Java Overload Functions
    > -----------------------
    >
    > private String func1(String FldName)
    > {
    > int index = 0;
    > index = Row.column_name.indexOf(FldName);
    >

    return(((Vector)Row.column_value.elementAt(this.curRecPointer)).elementAt(in
    dex).toString()
    > );
    > }
    >
    > private String func1(int index)
    > {
    > if (index > Row.column_name.size())
    > {
    > this.Error = -1;
    > this.ErrDescription = "Field Index out of bounds";
    > return ("");
    > }
    > else

    return(((Vector)Row.column_value.elementAt(this.curRecPointer)).elementAt(in
    dex).toString()
    > );
    > }




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center