posted 23 years ago
My guess is that you are getting a little tangled between what happens when the JSP is running (the page is generated as a load of text) and when the page is being shown by the browser (HTML is formatted and displayed, JavaScript is run).
If you want to generate the text you have shown at "JSP" time, just build it in a StringBuffer exactly as you have shown it here, then write that StringBuffer to the output stream. Your custom-built JavaScript instructions will then be included in the page, ready to be run when the page is displayed.
Has that helped ?