• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to pass an array as parameter to a script

 
K West
Ranch Hand
Posts: 58
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a script where I want to pass a Array.

The script is:



And I am holding the resultset in an array String[] lstTo which I want to pass to this script.

how can I pass an Array as third parameter to this script?

Any help appreciated.

Thank You.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take the time to choose the correct forum for your posts. This forum is for questions on JSP.

For more information, please read this.

This post has been moved to a more appropriate forum.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
resultset? In JavaScript? You'll need to explain what you are doing more clearly. A resultset is a server-side concept that has nothing to do with JavaScript.
 
K West
Ranch Hand
Posts: 58
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
That was fast..let me explain you my Issue.

On a jsp page, I have a textfield and I found a script which allows autocomplete on that textfield.



If I pass the array to that script as shown above it works fine.

From xml I get the values as,



Now I want to pass this array as second parameter to the script.




How do I do this?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, you should have posted that to being with. Now we can see that it's a JSP, not a JavaScript issue. I'll move this back to the JSP forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, obviously JavaScript has no access to server-side constructs. (If that's not clear, perhaps this article will be helpful).

So you need to use JSP mechanisms to create a JavaScript construct that contains the data that you want to access at the client.
 
K West
Ranch Hand
Posts: 58
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey I solved it.

what I did is,


I got the values in array in a String temp.

where temp has the string 'Test1 Test1; ', 'Test2 Test2; ',...

Thank You again...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65524
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's the way -- except I would urge you to adhere to current best practices and explore the use of the JSTL and EL in your JSP pages in place of old-fashioned scriptlets and scriptlet expressions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!