On Jan 31, 11:48 am, Norris Boyd <[EMAIL PROTECTED]> wrote:
> On Jan 31, 10:39 am, Rhino user <[EMAIL PROTECTED]> wrote:
>
>
>
> > My Java Function returns an array of objects.
> > In the javascript what I do is assign this array to another property.
> > e.g.
> > field.getColor() return an array ["rgb",0,0,1]
> > if I do an operation like
> > field1.setColor(field2.getColor)
> > it works fine.
> > But if I have a JS like -
> > message.value = field.color() ( I am trying to display the color
> > value in a message box)
> > then it puts the value as -[Ljava.lang.Object;@13d28e3
> > I want to display the color value as - RGB,0,0,1
> > I am wrapping the value as Context.javaTojs while returning from the
> > java function.
> > What am I doing wrong?
> > Thanks
> > Anupama
>
> This is no different than if you were in Java: an array object can be
> passed to a method that takes an array, but when you call toString on
> it you get something like "[Ljava.lang.Object;@13d28e3". Try using
> Arrays.toString to get what you want:
>
> js> var s = new java.lang.String("hello");
> js> var a = s.getBytes()
> js> a
> [EMAIL PROTECTED]
> js> java.util.Arrays.toString(a)
> [104, 101, 108, 108, 111]
>
> --N
Actually , I am on JDK 1.4. And my method is expected to return an
array.
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino