Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

JavaScript to Java Applet arrays

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to pass a JavaScript array to a Java Applet. However, it keeps spitting errors. This is how i'm creating and passing the array:
function CreateObject(_pageName,_objectType,_objectName){
var params = new Array();
var j=0;
for(var i=3;i<CreateObject.arguments.length;i++){
params[j] = CreateObject.arguments[i]+"";
j++;
}
/*for(var i=0;i<params.length;i++)
document.write(params[i]+" ");*/
if(OM){
OM.createObject_pageName,_objectType,_objectName,params);
}
}
"OM" is the java applet. _pageName,_objectType, & _objectName are ok, but when I tried reading the params array it chokes.
The java function is:
public int createObject(String _pageName, String _objectType, String _objectName, String[] _params) {
for(int i=0;i<_params.length;i++)
System.out.println(_params[i]);
return -1;
}
Anything wrong here? wrong logic? wrong syntax? Do I need to receive the _params array as a JSObject[] instead?
Thanks!
 
Oh. Hi guys! Look at this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic