By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,600 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,600 IT Pros & Developers. It's quick & easy.

passing javascript value to jsp page

P: n/a
Hi,

I would like to find out how to do the above.

I retrieve the value from database using a javabean and return this to
jsp page and display the data using html/javascript dropdown listbox.

I will need to use the selected value from user and pass this value to
javabean to retrieve another value to be displayed on the same
page/form (without having to submit the page)

Pls help.

Oct 4 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
i am assuming that you already know how to get the info from the db, as
that is far beyond the scope of this group. (if not, comp.lang.java.*
would be a good place to ask about that)

what you are talking about is using the XMLHTTPRequest object (commonly
known as ajax) it sounds like, then modifying the DOM to use the
returned info. ajax itself would require a long reply just to explain,
so i will refer you to http://jibbering.com/2002/4/httprequest.html and
, easily the two best tutorials around. assuming you return a XML doc
with the info you need (simplest way), with each option wrapped in an
<option> tag, you would then do something to the effect of:

dropdown = document.getElementById('theDropDownListToModify') ;
opts = xmlhttpObj.returnedXML.getElementsByTagName('optio n');
for (i=0;i<opts.length;i++) {
dropdown.options[i] = new Option(opts[i].firstChild.data;
}

If that isn't clear (it is late) email me or whatever and i would be
glad to help more

Oct 4 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.