wood burning stoves*
The moose likes JSP and the fly likes How to pass JSP resultant data to javascript? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to pass JSP resultant data to javascript?" Watch "How to pass JSP resultant data to javascript?" New topic
Author

How to pass JSP resultant data to javascript?

Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

Hi to All,
Actually I'm trying to call a JSP from javascript and wanna to get some data from it. This JSP will read some file and return data, this data has to be passed back to javascript so that I'll would be populating another html page form fields.

I've created JSP file to read file and displayed in new window by calling javascript function through window.open but instead of displaying the data in browser window want to have it in javascript variable.

Kindly help me out this.


No pain, No gain.
OCJP 1.6
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Wow. You shouldn't have resultsets in a JSP at all -- nor any Java code.

In any case, remember that JavaScript executes on the client and JSP on the server, so they cannot interact directly. Please read this article for an explanation of how JSP works.

You might also find this article useful for properly structuring a web app.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Kumaravadivel Subramani
Ranch Hand

Joined: Jul 05, 2008
Posts: 166

Thanks for given the nice explanation with article.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to pass JSP resultant data to javascript?
 
Similar Threads
Display Java Method Result in JSP
Passing values from child to parent window
Problems with calling window.open within a JSP
Displaying a HTML file in the new Browser Window using JSP
Handle file content using javascript