Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Ajax-Struts

 
Shihad Salam
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • 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
 
Joe Ess
Bartender
Posts: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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.
 
vipul bondugula
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
  • 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
  • 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: 9300
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic