posted 15 years ago
Remember that Javascript runs in the web browser, while the variable you're trying to look at exists in the Java code generated from the JSP, which runs on the server; by the time the Javascript runs, the Java variable no longer exists. What you need to do instead is write Java code to explicitly generate a Javascript array out of the Java array data. The Java code will run on the server when the page is executed, and it should create the proper Javascript code to initialize a Javascript array containing the same elements. That Javascript code will be embedded in the page, and it will be downloaded to the browser and executed there.