• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Ajax-Struts

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, i am new to struts. I tried to populate a drop down list based on change in another select box. Pieces of code is given:

jsp:
....


javascript fn:




action class: banking.ShowBankBranches.java

--------------------------------------------------------------------------------------------------------------------------------
In Jsp am getting all values. But it is not getting in the drop down (which is marked as bold). How can i get those values in drop down list from action class. Please help me. Its Urgent

Thanks
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch.
Please UseCodeTags in the future. I have added them to your post so it is readable.
In this line in the JavaScript you create a function:

This should be the name of the callback from the AJAX call where you would populate your DIV.
 
Ranch Hand
Posts: 253
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You did set the response in text/xml.
so, your statement will be
document.getElementById("branches").innerHTML=xmlhttp.responseXML;
Try this....
 
Shihad Salam
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, thanks for your reply.

When i tried in my javascript fn, i am getting list of values. But my real doubt is how can i get those list of data's in the drop down list of jsp ie, inside <html:select> tag as option. Please help me with code. It will be a great help for me

Thanks
 
Joe Ess
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I told you that you need to declare a callback function to handle the reply. vipul gave you a line which would insert HTML at a particular point. That's pretty much all there is to it. What have you done to implement our suggestions?
 
reply
    Bookmark Topic Watch Topic
  • New Topic