I don't know JSP, but I do know how to inject server variables into JavaScript. In PHP it would be something like this:
Code:
//JavaScript document
<?php
$arr = array('Bob', 'Tom', 'Harry');
?>
var arr = <?php echo('[' . implode(',', "'" . $arr . "'") . ']'); ?>;
The function 'echo' writes output to the client; 'implode' puts each array value, surrounded by single-quotes, together with a comma between each consecutive pair. The dots concatenate strings together like a plus-sign does in Java. The output of the above would be:
Code:
//JavaScript document
var arr = ['Bob','Tom','Harry'];