This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread 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


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: 61315
    
  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: 61315
    
  66

You could do it that way, but why do it the hard way?
 
GeeCON Prague 2014
 
subject: sending array of parameters to html from servlet