This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes HTML, CSS and JavaScript and the fly likes sending array of parameters to html from servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "sending array of parameters to html from servlet" Watch "sending array of parameters to html from servlet" New topic
Author

sending array of parameters to html from servlet

indu yeturu
Ranch Hand

Joined: Aug 27, 2008
Posts: 123
Hi all,

My html code contains a dropdown box, which has to be loaded with the values of database. For this I connected to Servlet with Ajax, there I have database values.
Now I need to send these array of string values to html. How to send an array of strings to html from servlet?
please can I get detailed solution ?, as am very very new to Ajax..

thanks inadvace


thanks,
indu
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

What JavaScript library are you using? Most (all) of them do this very easily.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

For example, with jQuery's load() method, you can format the options on the server (using a JSP or PHP or whatever) and just load them into the <select> element with:


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
indu yeturu
Ranch Hand

Joined: Aug 27, 2008
Posts: 123
thank you somuch for your suggetions.. I will gothrough JQuery..
Upto now, i thought of getting values in some xml format from servlet to html and rearranging....
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61082
    
  66

You could do it that way, but why do it the hard way?
 
jQuery in Action, 2nd edition
 
subject: sending array of parameters to html from servlet