Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP with JavaScript  RSS feed

 
Anuraag Kumar
Greenhorn
Posts: 10
Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got a Jsp doubt.......i have passed a 2 dimensional string array from servlet into jsp using session.getAttribute()......is there any way to pass this 2-D array into a JavaScript function in the same jsp page...?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66188
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not directly. JSP runs on the server, JavaScript on the client. Please read this article to understand how JSP operates.

What you can do is to use JSP to "write" the JavaScript necessary to re-create the data on the page in JavaScript format.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!