aspose file tools
The moose likes JSP and the fly likes how to store value from servlet to java script variable Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "how to store value from servlet to java script variable" Watch "how to store value from servlet to java script variable" New topic
Author

how to store value from servlet to java script variable

jack dsuza
Greenhorn

Joined: Feb 10, 2012
Posts: 1
i have created a one java script file in that i have written a html code in boilerplate variable and ajax to call servlet .
in java servlet i have written a code for select query as to select data from database table and store tihs value in resultset
i want to store this resultset value in to javascript variable.
how i store it ???
eg:-suppose i have table with firstname and Lastname fields and if i retrive this column in java servlet then i want this two column value to save/store in a java script variable on java script file
like var fname=???
var lname=???
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

Well, first of all you shouldn't be emitting output in the servlet. You should be forwarding to a JSP to create the view.

But regardless, the answer is the same. You simply write the JavaScript markup to the response.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: how to store value from servlet to java script variable
 
Similar Threads
How to display retrivied users from the Datase into Drop-down menu using servlet+JSP(JSTL)
checkbox and select
Drag and drop dynamic elements
how to connect to database and display query vqlus using proper java/jsp
Help ME PLZ. Very Soon..